Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / 1) Write high-level and detailed pseudocode for a program that calculates the current balance in a bank account

1) Write high-level and detailed pseudocode for a program that calculates the current balance in a bank account

Computer Science

1) Write high-level and detailed pseudocode for a program that calculates the current balance in a bank account. The program must ask the user for

 

  • The starting balance
  • The total dollar amount of deposits made
  • The total dollar amount of withdrawals made

 

Once the program calculates the current balance, it should be displayed on the screen.

 

 

2. The variable sum starts with the value 0.

       Add 10 to sum.

       Add 15 to sum.

       Add 20 to sum.

       Display the value of sum on the screen.

 

 

 

3.  The variable x starts with the value 0.

       The variable y starts with the value 5.

       Add 1 to x.

       Add 1 to y.

       Add x and y, and store the result in y.

       Display the value in y on the screen.

 

 

4.  The variable j starts with the value 10.

       The variable k starts with the value 2.

       The variable l starts with the value 4.

       Store the value of j times k in j.

       Store the value of k times l in l.

       Add j and l, and store the result in k.

       Display the value in k on the screen.

 

 

 

5. The variable a starts with the value 1.

      The variable b starts with the value 10.

      The variable c starts with the value 100.

      The variable x starts with the value 0.

      Store the value c times 3 in x.

      Add the value of b times 6 to the value already in x.

      Add the value of a times 5 to the value already in x.

      Display the value in x on the screen.

 

 

 

 

Chapter 2 -Problems 1 thru 20, 21, 22, 23, 25, 26, 27

 

  1. Every complete statement ends with a ___________. 

 

  1. To use cout statements you must include the ______ file in your program.

 

  1. Every C++ program must have a function named _______.

 

  1. Preprocessor directives begin with a __________.

 

  1. A group of statements, such as the body of a function, must be enclosed in ______.

 

  1. 72, ‘A’, “Hello World” are all examples of __________.

 

 

  1. 978.65 x 10^12 would be written in E notation as ________.

 

  1. The character literal ‘A’ requires _______byte(s) of memory, whereas the string literal ‘A’ requires ______ bytes(s).

 

 

  1. Which of the following are not valid assignment statements?

 

  1. If the variable letter has been defined as a char variable, which of the following are not valid assignment statements?

 

  1. Which of the following are not valid cout statements?

 

  1.  Which of the following are not valid cout statements?

 

  1. Assume x = 4, y = 7, and z = 2. What value will be stored in integer variable result by each of the following statements?

 

  1. Assume x = 2.5, y = 7.0, and z = 3. What value will be stored in integer variable result by each of the following statements?

 

  1.  Write a  C++ statement that defines the double variable temp, weight, and height all in the same statement.

 

 

  1. Write a C++ statement that defines the int variables months, days, and years all in the same statement, with months initialized to 2 and years initialized to 3.

 

 

  1. Write assignment statements that perform the following operations with int variable I, double variables d1 and d2, and chat variable c.

 

 

  1. Add 2 to d1 and store the result in d2
  2. Multiply d2 times 4 and store the result in d1.
  3. Store the character ‘K’ in c.
  4. Store the ASCII code for the character ‘K’ in i.
  5. Subtract 1 from the I and store the result back in i.

 

  1. Write assignment statements that perform the following operations with int varible i, double variables d1 and d2, and char variable c.

 

  1. Subtract 8.5 from d2 and store the result in d1.
  2. Divide d1 by 3.14 and store the result in d2.
  3. Store the ASCII code for the character ‘F’ in c.
  4. Add 1 to I and store the new value back in i.
  5. Add d1 to the current value of d2 and store the results back in d2 as its new value.

 

  1. Modify the following program segment so it prints two blank lines between each line of text.

cout << “Two mandolins like creatures in the” ;

cout << “dark” ;

cout << “Creating the agony of ecstasy.” ;

coutt << “                                  - George Barker”;

 

  1. Rewrite the follow statement to use the newline escape character, instead of an endl, each time subsequent output is to be displayed on a new line.

 

cout << “L” << endl

        << “E” << endl

        << “A”<< endl

        << “F” << endl;

 

21. Create detailed pseudocode for a program that calculates how many days are left

until Christmas , when given as an input how many weeks are left until Christmas.

Use variables named weeks and days.

 

 

22. Create detailed pseudocode for a program that determines how many full 12-egg

cartons of eggs a farmer can pack when given as an input the number of eggs he has

collected on a given day. Use variables named eggs and cartons.

 

 

23. Create detailed pseudocode for a program that determines distance traveled when

given inputs of speed and time. Use variables named speed, time, and distance.

 

24. What will the following programs print on the screen?

 

A) #include <iostream>

using namespace std;

int main ()

{

int freeze = 32, boil =

freeze = O;

boil = 10 0;

212· '

cout << freeze << endl << boil << endl;

return O;

}

 

 

 

B) #include <iostream>

using namespace std;

int main ( )

{

}

int x = O, y = 2;

x = y * 4;

cout << x << endl << y << endl;

return O;

 

 

 

 

C) #include <iostream>

using namespace std;

int main ( )

{

}

cout

cout

<< ''I am the incredible '' ;

<< '' computing\nmachine '';

cout << '' \nand I will \namaze \n '';

cout << ''you. \n '';

return O;

 

 

 

 

 

25.

A) #include <iostream>

using namespace std;

int main ( )

{

}

cout << ''Be careful! \n '';

cout << ''This might/n be a trick '';

cout << ''question. \n '';

return O;

 

 

B) #include <iostream>

using namespace std;

int main ( )

{

}

int a, x = 23;

a = x % 2;

cout << x << endl << a << endl;

return O;

 

 

26. The following program contains syntax errors. Locate as many as you can.

*/ What 's wrong with this program? /*

#include iostream

using namespace std;

 int main ( ) ;

 } int a, b, c \\ Three integers

a = 3

b = 4

c = a + b

Cout < ''The value of c is %d '' < C;

return O;

{

 

 

Option 1

Low Cost Option
Download this past answer in few clicks

3.83 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE