PSEUDOCODE

MUST BE COMPLETED TODAY AT 9PM EST!!!!!

1. Train Ticket 

Train Ticket for one person. Write a program that reads a persons age, then computes and displays the price the person needs to pay for the train ride according to the following rules: 

  • Children younger than 6 years old ride for free. 
  • If the ticket is bought at the train station:  
    • A person over 70 years old pays $5.20 
    • Everyone else pays $11.50. 
  • If ticket is bought inside the train, there is an extra charge of 15% compared to train station prices. 

Note that a persons age is within the range of 0 to 120 years. Other inputs are considered error conditions.

1.1- Inputs, Outputs and Error Conditions

In the space below, determine the inputs, outputs and error conditions for the problem.

1.2- Algorithms
In the space below, write your algorithm using pseudocode

1.3- Test cases

In the space below, list a thorough set of test cases for your program. Write in the following format [inputs], where the inputs are separated by commas. [inputs][output]

2. Bank

A bank charges fees and/or gives interest based on the balance of a customer. Write a program that reads the customer balance then calculates and displays the new balance after the application of fees and or interest based on the following rules:

A negative balance incurs a $50 overdraft fee. A balance below $500 (but positive) incur on a $10 maintenance fee. A balance from $500 to $1000 (inclusive) gain 0.1% interest. A balance over $1000 will gain 2% interest.

2.1-Input, Output, Error Conditions

In the space below, determine the inputs, outputs and error conditions for the problem.

2.2- Algorithm

In the space below, write your algorithm using pseudocode 

2.3- Test cases

In the space bellow, list a thorough set of test cases for your program. Write in the following format [inputs], where the inputs are separated by commas. [inputs][output]

3. Count Operations – WCS111 FM

WCS111 FM, a radio station by computer scientists for computer scientists. The station runs a contest where listeners win prizes based on how many hours they spend programming in Java. The following program displays the listener prize based on the number of hours spent programming.

3.1- Minimum

What is the minimum number of operations that can be executed in the code?

3.2- Maximum

What is the maximum number of operations that can be executed in the code?

4. Count Operations – Lucky Twos

Lucky Twos determines and displays the number of digits that are 2s in a whole number. For example, the number of 2s in 3487 is 0, while the number of 2s in 272521 is 3. Note: whole numbers are non-negative integers starting at zero 0, 1, 2, 3, 4. Assume that the fractional part is discarded in the division: 10 / 4 = 2 8 / 5  = 1 20 / 3 = 6

4.1- Let n be the number of digits of the whole number. What is the number of operations that are executed in the code in terms of n?