Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For each of the following 4 problems provide: inputs, outputs, error conditions,

ID: 3754442 • Letter: F

Question

For each of the following 4 problems provide: inputs, outputs, error conditions, an algorithm using pseudocode, the minimum and the maximum number of operations, and a set of test cases 1. Multiplication: Compute and display the result of how much a certain number of pounds of apple costs. 2. Gas: Compute and display the price a person will pay for gas at the gas station. If the person pays with a credit card, there is an extra charge of 10% of the total price. 3. University tuition: Compute the tuition a student pays at an university, given the following rules: Every student pays a campus fee of $6.87 Each one credit costs $20 An university employee pays only campus fee State employee pays campus fee + 10% of total number of credits cost Assume a student cannot be an university employee and a state employee at the same time A student paying in installments pays an additional 3% of total amount owed 4. Zoo census: There are a number of zoos in the United States. Each of these zoos is a home to giraffes, lions and snakes. Determine and display the total number of each (giraffes, lions, and snakes) in the zoos in the United States. Assume positive values.

Explanation / Answer

1.

input: number of pounds of apple to be bought, cost of apple per pound

Output: Expense to be made to buy apples.

Error condition: number of pounds <0, price per pound < 0

Algorithm using pseudo-code:

Step 1 : Declare variables Ans = 'Y', no_of_pounds, price_per_pound, cost

Step2 : While ( Ans = 'Y')

Step2.1 : Read no_of_pounds,price_per_pound

Step2.2 : cost := no_of_pounds * price_per_pound

Step2.3 : Print cost

Step2.4 : Provide the option for continue (Y) or abort (N)

Step2.5 : Read ans

  

Step3: End.

The minimum number of operation : 1 (As, one will go to the loop at least once,beacuse the value of 'ans' is 'Y' by default.

Maximum operations: As many times as one wants. As many times the user will want to continue the loop will iterate.

Set of test cases:

1.

no_of_pounds = 2

price_per_pound = 4

2.

no_of_pounds = 6

price_per_pound = 4

2.

Input : Litre of gas to be bought, Price per litre, Payment type

Output : Payment to be made

Error Condition : Litre of gas to be bought<0 , Price per litre<0

Pseudo-code:

Step1: Declare variables Litre of gas to be bought, Price per litre, ans, Cost, choice = 1

Step2: while (choice == 1)

Step2.1: Read Litre of gas to be bought,  Price per litre

Step2.2: Print " Do you have credit card, Press Y for yes and N for no

Step2.3: Read ans

Step2.4: if (ans = 'Y')

Step 2.4.1: cost =  Litre of gas to be bought * Price per litre * 1.1

Step 2.4.2: Print cost

Step2.5: if (ans = 'N')

Step 2.5.1: cost =  Litre of gas to be bought * Price per litre

Step 2.5.2: Print cost

Step 2.6: Print "Do you want to continue? if yes enter 1

Step 2.7: Read choice

Step3: Exit

Minimum No of Operations: 1 ( As the value of option = 1)

Maximum No of Operations: As many as you want

Set of test cases:

1. Litre of gas to be bought = 2

Price per litre, Payment type = 20

2. Litre of gas to be bought = 3

Price per litre, Payment type = 10

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote