Your mission... A gas station credits customers with $0.05 (5 cents) towards a car wash for...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Your mission... A gas station credits customers with $0.05 (5 cents) towards a car wash for every litre of regular gasoline purchased and $0.06 (6 cents) for every litre of premium gasoline purchased. Your job is to write a program that will calculate how many car washes have been earned by a customer. Requirements Create a source code file named Your_Initials_CarWash.java. For example, if your name is Sam Turner, you would name it ST_CarWash.java. Make sure that you save your new file immediately. Now write a short program that does all of the following, in sequence: 1. Prints an explanation of the purpose of the program as shown in the screenshot below. 2. Asks the user to enter the number of litres of regular gasoline purchased as well as the number of litres of premium gasoline purchased. Each of these two values should be assigned to a variable of an appropriate type given that it will be used in calculations. Since no credit is given for part of a litre you can assume that no decimal places will be required. 3. Asks the user to enter the price of a car wash (e.g. $10.99) and assigns this to a suitable variable. 4. Asks the user to enter the model of the customer's vehicle (e.g. "2012 Toyota RAV4") and assigns this to an appropriate variable. 5. Declares a pair of constants of a suitable type called CREDIT_FOR_REGULAR which is assigned the value 0.05 and CREDIT_FOR_PREMIUM which is assigned the value 0.06. This is the credit in dollars awarded to the customer for each litre of fuel purchased. 6. Declares a suitable variable to store the total credit earned towards car washes and assigns it a value calculated using the following formula: 7. Declares another suitable variable to store the number of complete car washed earned and assigns it a 7. Declares another suitable variable to store the number of complete car washed earned and assigns it a value by dividing the total credit by the price for a wash. We don't want decimal places here so truncate the answer and store it in a variable without decimal places. 8. Declares yet another suitable variable to store the extra credit earned in excess of the complete car washes earned and assigns to it this calculated amount. For example, if a customer has earned a total credit of $23.05 and a car wash is $10.99 then 2 washes have been earned and there will be $23.05 – 2 x $10.99 $1.07 of credit remaining (leftover). 9. Outputs the total credit, the number of washes, the extra credit and the vehicle model using the format shown in the sample output below. For the extra credit earned, TRUNCATE ANY DECIMALS BEYOND TWO PLACES so that it reads as a proper dollar and cents amount. = Calculating the number of car washes earned based on your gas purchases... Enter the litres of regular gas purchased: 311 Enter the litres of premium gas purchased: 125 Enter the price of a car wash: $ 10.99 Enter the model of your vehicle: 2012 Toyota RAV4 Your total credit earned is $23.05. You've earned 2 car wash(es) for your 2012 Toyota RAV4. The extra credit earned is $1.07 Your mission... A gas station credits customers with $0.05 (5 cents) towards a car wash for every litre of regular gasoline purchased and $0.06 (6 cents) for every litre of premium gasoline purchased. Your job is to write a program that will calculate how many car washes have been earned by a customer. Requirements Create a source code file named Your_Initials_CarWash.java. For example, if your name is Sam Turner, you would name it ST_CarWash.java. Make sure that you save your new file immediately. Now write a short program that does all of the following, in sequence: 1. Prints an explanation of the purpose of the program as shown in the screenshot below. 2. Asks the user to enter the number of litres of regular gasoline purchased as well as the number of litres of premium gasoline purchased. Each of these two values should be assigned to a variable of an appropriate type given that it will be used in calculations. Since no credit is given for part of a litre you can assume that no decimal places will be required. 3. Asks the user to enter the price of a car wash (e.g. $10.99) and assigns this to a suitable variable. 4. Asks the user to enter the model of the customer's vehicle (e.g. "2012 Toyota RAV4") and assigns this to an appropriate variable. 5. Declares a pair of constants of a suitable type called CREDIT_FOR_REGULAR which is assigned the value 0.05 and CREDIT_FOR_PREMIUM which is assigned the value 0.06. This is the credit in dollars awarded to the customer for each litre of fuel purchased. 6. Declares a suitable variable to store the total credit earned towards car washes and assigns it a value calculated using the following formula: 7. Declares another suitable variable to store the number of complete car washed earned and assigns it a 7. Declares another suitable variable to store the number of complete car washed earned and assigns it a value by dividing the total credit by the price for a wash. We don't want decimal places here so truncate the answer and store it in a variable without decimal places. 8. Declares yet another suitable variable to store the extra credit earned in excess of the complete car washes earned and assigns to it this calculated amount. For example, if a customer has earned a total credit of $23.05 and a car wash is $10.99 then 2 washes have been earned and there will be $23.05 – 2 x $10.99 $1.07 of credit remaining (leftover). 9. Outputs the total credit, the number of washes, the extra credit and the vehicle model using the format shown in the sample output below. For the extra credit earned, TRUNCATE ANY DECIMALS BEYOND TWO PLACES so that it reads as a proper dollar and cents amount. = Calculating the number of car washes earned based on your gas purchases... Enter the litres of regular gas purchased: 311 Enter the litres of premium gas purchased: 125 Enter the price of a car wash: $ 10.99 Enter the model of your vehicle: 2012 Toyota RAV4 Your total credit earned is $23.05. You've earned 2 car wash(es) for your 2012 Toyota RAV4. The extra credit earned is $1.07
Expert Answer:
Answer rating: 100% (QA)
Below is a simple Java program that fulfills the given requirements java import javautilScanner publ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
In this assignment, you will create a program that allows theuser to draw in a window using brushes of different sizes andcolors. The user will be able to change the size and color of thebrush using...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Shelby Company has an available production capacity of 180,000 hours. This can be used to produce 3 products in any combination. The total fixed cost is 180,000. Other information is as follows: X Y...
-
A ski boat moves with constant velocity. Is the net force acting on the boat doing work? Explain.
-
How does quality control in services involving customer contact differ from typical manufacturing practices?
-
The following data are for Huang Wong Ping Retail Outlet Stores. The account balances (in thousands) are for 2017. 1. Compute (a) the cost of goods purchased and (b) the cost of goods sold. 2....
-
Paul Bergey is in charge of loading cargo ships for International Cargo Company (ICC) at the port in Newport News, Virginia. Paul is preparing a loading plan for an ICC freighter destined for Ghana....
-
Let us consider measuring a scalar parameter with an observation model Zk = 0 + Vk, k = 1,. K where v are independent, Gaussian distributed random variables with = 0 and = 0, V k. Derive the maximum...
-
The CitruSun Corporation ships frozen orange juice concentrate from processing plants in Eustis and Clermont to distributors in Miami, Orlando, and Tallahassee. Each plant can produce 20 tons of...
-
The MillerCorp would like to acquire its competitor, the ModiglianiCorp. To pay for the acquisition expenses, it is intending to issue bonds that pay semiannual coupon payments. These corporate bonds...
-
You are working as a financial advisor at a major bank. A non-working single women 61 years old (NY City Resident) is introduced to you from a mutual friend. She is extremely risk-averse and has...
-
In the context of helping and sharing, "cheating" is defined as choices accepting a benefit from another individual without reciprocating providing a benefit for another individual without expecting...
-
Explain why export-biased growth may potentially lead to an adverse effect on home countrys welfare. Make sure to describe the measure that you use for welfare in your analyses
-
Evaluate. logg 10%9 1 81 1 81 0
-
Although Juana earns a meager salary, she has been spending a lot of money on wedding-related expenses. She understands that she could go bankrupt if she does not stop making expensive purchases. In...
-
Juicy Fruits limited are extracting Mango juice from mangoes and classifying into 1 st ,2 nd ,3 rd and 4 th grades in the ratio 1:2:3:4. Juicy Fruits limited have adopted a modern juice extraction...
-
Evenflow Power Co. is considering a new project that is a little riskier than the current operations of the company. Thus, management has decided to add an additional 1.5% to the company's overall...
-
Find the following probabilities for the standard normal distribution. a. P(z < 2.34) b. P(.67 < z < 2.59) c. P(2.07 < z < .93) d. P(z < 1.78)
-
Let x be a continuous random variable that has a normal distribution with a mean of 117.6 and a standard deviation of 14.6. Find the probability that x assumes a value a. Between 77.9 and 98.3 b....
-
According to the American Time Use Survey, Americans watched television each weekday for an average of 151 minutes in 2011 (Time, July 11, 2011). Suppose that this result is true for the 2011...
-
Show how, using a single DFT of length \(N\), one can compute the DFT of four sequences: two even and real sequences and two odd and real sequences, all with length \(N\).
-
Show that the PSD function of a WSS random process \(\{X\}\) satisfies the following properties: (a) \(\Gamma_{X}(0)=\sum_{v=-\infty}^{\infty} R_{X}(v)\). (b) It is an even function; that is:...
-
Show how to compute the DFT of two even complex length- \(N\) sequences performing only one length \(N\) transform calculation. Follow the steps below: (i) Build the auxiliary sequence...
Study smarter with the SolutionInn App