Question

Describe the pseudocode for the following problem: Design a program to calculate the price of a r...

Describe the pseudocode for the following problem:

Design a program to calculate the price of a road trip. The different modules or methods needed would be calculating the cost of gas for the trip, calculating the lodging for the trip, calculating the cost of food for the trip, calculating the cost of admission to any sightseeing for the trip, etc. Try to design the pseudocode so that you are asking each module to return a value and the main method just adds up the costs based on what is returned from each method. The main method might need to ask the user how many days they are traveling and where they are going and then pass this information into the modules that need it.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
  1. float gascost(int days)
  2. {
  3. read gas_per_day;
  4. return days *gas_per_day;
  5. }
  6. float lodging(int days)
  7. {
  8. read lodge_per_day;
  9. return days *lodge_per_day;
  10. }
  11. float food(int days)
  12. {
  13. read cost_break_fast;
  14. read cost_lunch;
  15. read cost_dinner;
  16. read cost_snacks;
  17. total =(cost_break_fast+read cost_lunch+read cost_lunch+read cost_snacks)*days;
  18. return total;
  19. }
  20. float miscellaneous(int days)
  21. {
  22. total=0;
  23. for i=1 to days:
  24. {
  25. read expense;
  26. total=total+expense;
  27. }
  28. return total;
  29. }
  30. void main()
  31. {
  32. read no_days;
  33. total_cost=gascost(no_days)+lodging(no_days)+food(no_days)+miscellaneous(no_days);
  34. display(total_cost);
  35. }
Add a comment
Know the answer?
Add Answer to:
Describe the pseudocode for the following problem: Design a program to calculate the price of a r...
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
  • How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the use...

    How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the user to input the following. ○ How many apples are on hand ○ How many apples should be in stock ○ How many oranges are on hand ○ How many oranges should be in stock  Perform an operation to determine how many of...

  • C++ Programming Question: This programming assignment is intended to demonstrate your knowledge of the following: ▪...

    C++ Programming Question: This programming assignment is intended to demonstrate your knowledge of the following: ▪ Writing a while loop ▪ Write functions and calling functions Text Processing [50 points] We would like to demonstrate our ability to control strings and use methods. There are times when a program has to search for and replace certain characters in a string with other characters. This program will look for an individual character, called the key character, inside a target string. It...

  • C PROGRAMMING Introduction In this part, you will solve a problem described in English. Although you...

    C PROGRAMMING Introduction In this part, you will solve a problem described in English. Although you may discuss ideas with your classmates, etc., everyone must write and submit their own version of the program. Do NOT use anyone else’s code, as this will result in a zero for you and the other person! Shipping Calculator Speedy Shipping Company will ship your package based on the weight and how far you are sending the package, which can be anywhere in the...

  • == Programming Assignment == For this assignment you will write a program that reads in the...

    == Programming Assignment == For this assignment you will write a program that reads in the family data for the Martian colonies and stores that data in an accessible database. This database allows for a user to look up a family and its immediate friends. The program should store the data in a hashtable to ensure quick access time. The objective of this assignment is to learn how to implement and use a hashtable. Since this is the objective, you...

  • Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an...

    Additional code needed: PartA: BurgerOrder class (1 point) Objective: Create a new class that represents an order at a fast-food burger joint. This class will be used in Part B, when we work with a list of orders. As vou work through this part and Part B, draw a UML diagram of each class in using the UML drawing tool 1) Create a new Lab5TestProject project in Netbeans, right-click on the lab5testproject package and select New>Java Class 2) Call your...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

  • Please read the article and answer about questions. You and the Law Business and law are...

    Please read the article and answer about questions. You and the Law Business and law are inseparable. For B-Money, the two predictably merged when he was negotiat- ing a deal for his tracks. At other times, the merger is unpredictable, like when your business faces an unexpected auto accident, product recall, or government regulation change. In either type of situation, when business owners know the law, they can better protect themselves and sometimes even avoid the problems completely. This chapter...

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