Question

Instructions For each of the following 4 problems provide 1. inputs 2. outputs 3. error conditions 4. an algorithm using pseudocode 5. the minimum and the maximum number of operations 6. 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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

1)

input: number of pounds of apple to be bought, cost of the 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 liter, Payment type

Output: Payment to be made

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

Pseudo-code:

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

Step2: while (choice == 1)

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

Step 2.2: Print " Do you have the credit card, Press Y for yes and N for no

Step 2.3: Read ans

Step 2.4: if (ans = 'Y')

Step 2.4.1: cost =  Litre of gas to be bought * Price per liter * 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 liter

Step 2.5.2: Print cost

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

Step 2.7: Read choice

Step 3: 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 liter, Payment type = 20

2. Litre of gas to be bought = 3

Price per liter, Payment type = 10

3)

3. Pseudo code :

  1. Set Campus Fee CF to $6.87
  2. Set Credit Costs CC to $20
  3. Read student employment status ES
  4. If ES is university employee

Then SET ES to “UE”

        Else if ES is State Employee

Then SET ES to “SE”

         Else

       Set ES to “NE”

  1. If ES equals to UE then set FEE=CF (i.e. $6.87)

Else if ES equals to SE then set FEE=(CF+10/100*CC)

Else set FEE=CF+CC

  1. Read Payment Type PT
  2. If PT is by installments, then set PT to INS else FULL
  3. If PT equal to INS then

FEE=FEE+3/100*FEE

Else

FEE

       I .   Write FEE

4. Pseudo code :

  1. Read the number of Zoo in united states ‘NZ’
  2. Set Total no of giraffes, lions, snakes i.e. TNG, TNL, TNS to 0
  3. For i in 1 to ‘NZ’

Read no of giraffes in zoo(i) i.e. NG

Read no of lions in zoo(i) i.e. NL

Read no of giraffes in snakes (i) i.e. NS

Set TNG=TNG+NG

Set TNL=TNL+NL

Set TNS=TNS+NS

End loop

4. Write TNG , TNL,TNS

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

Add a comment
Know the answer?
Add Answer to:
Instructions For each of the following 4 problems provide 1. inputs 2. outputs 3. error conditions...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem 9-45 CVP Analysis; Strategy; Critical Success Factors [LO 9-1, 9-2, 9-3] Garner Strategy Institute (GSI)...

    Problem 9-45 CVP Analysis; Strategy; Critical Success Factors [LO 9-1, 9-2, 9-3] Garner Strategy Institute (GSI) presents executive-level training seminars nationally. Eastern University (EU) has approached GSI to present 40 one-week seminars during 2019. This activity level represents the maximum number of seminars that GSI is capable of presenting annually. GSI staff would present the week-long seminars in various cities throughout the United States and Canada. Terry Garner. GSi's president, is evaluating three financial options for the revenues from Eastern:...

  • 1. 2. 3. 4. 5. 6. 7. Shawna reads a scatterplot that displays the relationship between...

    1. 2. 3. 4. 5. 6. 7. Shawna reads a scatterplot that displays the relationship between the number of cars owned per household and the average number of citizens who have health insurance in neighborhoods across the country. The plot shows a strong positive correlation. Shawna recalls that correlation does not imply causation. In this example, Shawna sees that increasing the number of cars per household would not cause members of her community to purchase health insurance. Identify the lurking...

  • 1,List the first and last name of the donators that donated in December 2009. 2. List...

    1,List the first and last name of the donators that donated in December 2009. 2. List the ID's of the volunteers that have not worked. 3. List the ID, first name, and last name of any employees who works in the Finance department. 4. List all the different prices suppliers have for 'Tasty Meat' product. 5. Select the store ID and store phone number for all stores in 'St.Paul'. 6. List the member first and last name, address, city, zip...

  • Instructions Comprehensive Problem 2-1 Beverly and Ken Hair have been married for 3 years. Beverly works...

    Instructions Comprehensive Problem 2-1 Beverly and Ken Hair have been married for 3 years. Beverly works as an accountant at Cypress Corporation. Ken is a full-time student at Southwest Missouri State University (SMSU) and also works part-time during the summer at Cypress Corp. Ken's birthdate is January 12, 1993 and Beverly's birthdate is November 4, 1995. Beverly and Ken each received a W-2 form from Cypress Corporation (see separate tab). The Hairs have interest income of $1,000 on City of...

  • Part B. Gross Income Inclusions & Exclusions For each Q-6 through Q-19 below, determine whether the...

    Part B. Gross Income Inclusions & Exclusions For each Q-6 through Q-19 below, determine whether the item described should be INCLUDED IN or EXCLUDED FROM the Gross Income of the taxpayer who receives the item. • Darken Box A on the Scantron sheet if the item should be INCLUDED IN gross income • Darken Box B on the Scantron sheet if the item should be EXCLUDED FROM gross income 6. $25,000 scholarship for tuition and books received by a full-time...

  • PART 1 PART 2 PART 3 PART 4 PART 5 PART 6 PART 7 PART 8...

    PART 1 PART 2 PART 3 PART 4 PART 5 PART 6 PART 7 PART 8 -11 points BBUnderStat12 22 005 Ask Your Teache My Notes It is costly in both time and money to go to college. Does it pay off? According to the Bureau of the Census, the answer is yes. The average annual income (in thousands of dollars) of a household headed by a person with the stated education level is as follows: 24.9 if ninth grade...

  • 2) compute contribution margin for each channel 3) compute break even point (in terms of number...

    2) compute contribution margin for each channel 3) compute break even point (in terms of number of orders and dollars) for each distribution channel (HINT  - Fixed costs are all trade show expenses.  Use depreciation for the booth as a fixed cost.  The booth cost should be considered an investment not a fixed cost) 4) Calculate the number of orders at a target profit of $100,000 5) Calculate the profitability for both the low and high order estimates We were...

  • 2) Populations versus samples. For each statement, answer with either population, sample, or both. A) The compl...

    2) Populations versus samples. For each statement, answer with either population, sample, or both. A) The complete set of information. B) A portion, not all, of the information. C) Has the potential to be biased or misleading. D) Measured or summarized with parameters. E) Measured or summarized with statistics. 3) Descriptive versus inferential statistics. For each statement, answer with either descriptive or inferential statistics. A) Facts about samples. B) Educated guesses about populations based on samples. C) The world population...

  • Comprehensive Problem 6-52 (LO 6-1, LO 6-2, LO 6-3) [The following information applies to the questions...

    Comprehensive Problem 6-52 (LO 6-1, LO 6-2, LO 6-3) [The following information applies to the questions displayed below.] Read the following letter and help Shady Slim with his tax situation. Please assume that his gross income is $172,900 (which consists only of salary) for purposes of this problem. December 31, 2019 To the friendly student tax preparer: Hi, it’s Shady Slim again. I just got back from my 55th birthday party, and I’m told that you need some more information...

  • Required information [The following information applies to the questions displayed belowj John and Sandy Ferguson got...

    Required information [The following information applies to the questions displayed belowj John and Sandy Ferguson got married eight years ago and have a seven-year-old daughter, Samantha. In 2018, John worked as a computer technician at a local university earning a salary of $153,500, and Sandy worked part-time as a receptionist for a law firm earning a salary of $30,500. John also does some Web design work on the side and reported revenues of $5,500 and associated expenses of $1,500. The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT