Question

I need help with this C++ code for my programming class. Thank You! You own EasyButCostly...

I need help with this C++ code for my programming class. Thank You!

You own EasyButCostly Parking Garage. Write a program to calculate the parking fees based on the number of hours a car is parked in your EasyButCostly Parking Garage. You will read in the number of hours from the user into a variable of type double and output the parking fees. The parking fees are charged as follows:

Hours Fees
up to 5 $10
more than 5 but less than 10 $40
at least 10 but not more than 20 $160
more than 20 $200
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
using namespace std;

int main()
{
   double hours;
   // opening message
   cout << " Welcome to EasyButCostly Parking Garage!" << endl;
   // getting user input
   cout << " Please enter number of hours parked: ";
   cin >> hours;
   if(hours <= 5)
   {
       cout << " Your fees: $10" << endl;
   }
   else if(hours > 5 && hours < 10)
   {
       cout << " Your fees: $40" << endl;
   }
   else if(hours >= 10 && hours <= 20)
   {
       cout << " Your fees: $160" << endl;
   }
   else
   {
       cout << " Your fees: $200" << endl;
   }

   return 0;
}

OUTPUT

Add a comment
Know the answer?
Add Answer to:
I need help with this C++ code for my programming class. Thank You! You own EasyButCostly...
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
  • I need help with this java project and please follow the instruction below. thank Class Project...

    I need help with this java project and please follow the instruction below. thank Class Project - Parking Ticket simulator Design a set of classes that work together to simulate a police officer issuing a parking ticket. Design the following classes: •           The ParkedCar Class: This class should simulate a parked car. The class’s responsibilities are as follows: – To know the car’s make, model, color, license number, and the number of minutes that the car has been parked. •          ...

  • C++ programming language , I need help writing the code . Please explain if you can...

    C++ programming language , I need help writing the code . Please explain if you can . Exercise 10: Unit conversion (10 points) Write a console program that converts meters into feet and inches. The program starts by asking the user for a measurement in meters. The program should accept a floating point number. After getting the number, the program computes the number of feet and inches equal to the specified number of meters. The program outputs feet and inches...

  • PLease, I need help with this Code. PLease create correctly documentations comments for better understanding. This...

    PLease, I need help with this Code. PLease create correctly documentations comments for better understanding. This is the input: JAV001 ARRIVE JAV002 ARRIVE JAV003 ARRIVE JAV004 ARRIVE JAV005 ARRIVE JAV001 DEPART JAV004 DEPART JAV006 ARRIVE JAV007 ARRIVE JAV008 ARRIVE JAV009 ARRIVE JAV010 ARRIVE JAV011 ARRIVE JAV012 ARRIVE JAV013 ARRIVE JAV014 ARRIVE JAV006 DEPART JAV014 DEPART JAV013 DEPART JAV005 DEPART JAV015 ARRIVE JAV010 DEPART JAV002 DEPART JAV015 DEPART JAV014 DEPART JAV009 DEPART JAV003 DEPART JAV008 DEPART JAV007 DEPART JAV012 DEPART JAV011...

  • This is java. I need help with my computer science class. Complete the ParkingGarage class shown...

    This is java. I need help with my computer science class. Complete the ParkingGarage class shown below. The ParkingGarage class keeps track of how many cars are present, the maximum number of cars it can hold and the parking fee. The number of cars present in the garage at any given time cannot exceed the maximum and can never be negative. public class ParkingGarage {       // declare instance variables       // postcondition: all instance variables are initialized       public...

  • Use the description from Parking Ticket Simulator from Chapter 14 as a basis, where you need...

    Use the description from Parking Ticket Simulator from Chapter 14 as a basis, where you need to create a Car class and Police Officer class, to create a new simulation. Write a simulation program (refer to the Bank Teller example in the PPT) that simulates cars entering a parking lot, paying for parking, and leaving the parking lot. The officer will randomly appear to survey the cars in the lot to ensure that no cars are parked beyond their time...

  • Objective: The objective of this lab is to get familiar with the syntax of the Java...

    Objective: The objective of this lab is to get familiar with the syntax of the Java programming language. This lab is designed to reinforce programming concepts. Instructions: Description of the Problem. A parking garage charges a $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour period is $10.00. Assume that no car parks...

  • Please help me with this exercises in JAVA, Thank you ===================== Parking Ticket Simulator Assignment =====================...

    Please help me with this exercises in JAVA, Thank you ===================== Parking Ticket Simulator Assignment ===================== For this assignment you will create a set of classes from scratch (no provided class files for this assignment) that work together to simulate a police officer issuing a parking ticket. You should design the following classes / functionality within them: ===================== ParkedCar.java: ===================== This class should simulate a parked car. The class's responsibilities are as follows: - To store the car's make, model,...

  • Assignment: My friend, Cary Parker, owns a small parking garage downtown. She wants you to write...

    Assignment: My friend, Cary Parker, owns a small parking garage downtown. She wants you to write a program to help her calculate the parking charge at the payment booth. The price to park in the lot is $5.50 per hour, plus city parking tax. However, partial hours (even one minute into an additional hour) are charged at the full hour’s rate. For example, if you park for exactly 60 minutes, or less, you will pay $5.50 plus tax, but if...

  • I was looking for help in my computer programming class. The program I need to create...

    I was looking for help in my computer programming class. The program I need to create is this. Program Specifications: Write a C program what will read in one word. Store this word in an array. Hint: char myWord[SIZE] = ‘ ‘; Once you store the word, you are to do the following four things: Display: The word is: abcdefg Display: The word backwards is: gfedcba Display: The word vertical is: A B C D E F G Display: The...

  • /*hello everyone. my question is mostly related to the garagetest part of this assignment that i've...

    /*hello everyone. my question is mostly related to the garagetest part of this assignment that i've been working on. i am not sure how to read the file's contents AND put them into variables/an array. should it be in an arraylist? or maybe a regular array? or no arrays at all? i am also not sure how to call the factory method from garagec. i'm thinking something along the lines of [Garage garage = new GarageC.getInstance("GarageC", numFloors, areaofEachFloor);] but i...

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