Java solution To start, display a welcome message Welcome to NOVA Gas. Then, use a sentinel value
Fantastic news! We've Found the answer you've been seeking!
Question:
Java solution
Transcribed Image Text:
To start, display a welcome message Welcome to NOVA Gas. Then, use a sentinel value loop to ask the user to enter NOVAGas to run the program like so: Enter NOVAGas to start filling up or Goodbye to quit. Be sure to use lower or upper string functions to change the value entered by the user to either lower case or upper case according to your choice so that you only have to test for either lower case or upper case in your while loop. Once you enter the loop, ask the user to input a credit or debit card number. Be sure to use a string function to validate the credit card number to ensure that it is between 15 and 16 digits long. Invalid. Credit card #23 must be either 15 or 16 digits in length: Also, convert the string to a list of characters and then check each character to see if it is a digit using the isDigit() function. We will work on an example in class. If something other than digits 0-9 appear, list the following error message: Invalid. Credit card %23 must contain digits. Please try again: Once you get a valid credit card number, let the user know that they can purchase a car wash and get a 5 cent discount for every gallon purchased. Then ask the user if they want to purchase a car wash. Be sure to use an upper case char function to convert to upper case for easier testing. See below: If you purchase a car wash, your price per gallon is reduced by 5 cents. Car Wash (Y/N)? Y After the user enters a choice for the car wash, display a menu showing the fuel types and prices, then accept the user input for the type of fuel they want to purchase. Be sure to use an upper case char function to convert to upper case for easier testing. See below: Please choose from the following fuel types: (R) egular $3.351 per gallon. (M) id-Grade $3.720 per gallon. (P) remium $4.042 per gallon. (D) iesel $3.797 per gallon. With a while loop, validate the fuel types to ensure that they are either R, M, P, D. If they choose a letter that is not R, M, P, D, display a message like the below and allow them to input the fuel type again: To start, display a welcome message Welcome to NOVA Gas. Then, use a sentinel value loop to ask the user to enter NOVAGas to run the program like so: Enter NOVAGas to start filling up or Goodbye to quit. Be sure to use lower or upper string functions to change the value entered by the user to either lower case or upper case according to your choice so that you only have to test for either lower case or upper case in your while loop. Once you enter the loop, ask the user to input a credit or debit card number. Be sure to use a string function to validate the credit card number to ensure that it is between 15 and 16 digits long. Invalid. Credit card #23 must be either 15 or 16 digits in length: Also, convert the string to a list of characters and then check each character to see if it is a digit using the isDigit() function. We will work on an example in class. If something other than digits 0-9 appear, list the following error message: Invalid. Credit card %23 must contain digits. Please try again: Once you get a valid credit card number, let the user know that they can purchase a car wash and get a 5 cent discount for every gallon purchased. Then ask the user if they want to purchase a car wash. Be sure to use an upper case char function to convert to upper case for easier testing. See below: If you purchase a car wash, your price per gallon is reduced by 5 cents. Car Wash (Y/N)? Y After the user enters a choice for the car wash, display a menu showing the fuel types and prices, then accept the user input for the type of fuel they want to purchase. Be sure to use an upper case char function to convert to upper case for easier testing. See below: Please choose from the following fuel types: (R) egular $3.351 per gallon. (M) id-Grade $3.720 per gallon. (P) remium $4.042 per gallon. (D) iesel $3.797 per gallon. With a while loop, validate the fuel types to ensure that they are either R, M, P, D. If they choose a letter that is not R, M, P, D, display a message like the below and allow them to input the fuel type again:
Expert Answer:
Related Book For
Starting Out With Java From Control Structures Through Data Structures
ISBN: 9780133957051
6th Edition
Authors: Tony Gaddis
Posted Date:
Students also viewed these databases questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Please check my code for errors agaisnt the assignment which is long. The parts Dog and rescueAnimals files cannot be changed nor the original given code in the Driver file only can modify where it...
-
Coffin Corporation appropriately uses the installment-sales method of accounting to recognize income in its financial statements. The following information is available for 2014 and 2015....
-
The IASB and FASB are maintaining/developing two different XBRL taxonomies. What effect, if any, might this have on convergence of accounting standards?
-
Suppose that you borrow $25,000 at 12% compounded monthly over five years. Knowing that the 12% represents the market interest rate, you realize that the monthly payment in actual dollars will be...
-
Determine the horizontal displacement of joint \(C . A E\) is constant. L P L A -L. B
-
Columbia Products Inc. has two divisions, Salem and Seaside. For the month ended March 31, Salem had sales and variable costs of $500,000 and $225,000, respectively, and Seaside had sales and...
-
What are some Strategy Formulation/Strategic Alternatives for Netflix? Explain what some strategic alternatives and formulation strategies for Netflix In-house content? Marketing Ad Content? o...
-
The revenue (in dollars) from the sale of x units of a certain product can be described by R(x) = 100x-0.01x2. Find the instantaneous rate of change of the marginal revenue. R"(x)=2 Need Help? Read...
-
Three point charges are located at the corners of an equilateral triangle as shown in the Figure below. Find the magnitude and direction of the net electric force on the 2.00 C charge. 7.00 C 2.00 C...
-
Three charges are arranged as shown in the Figure below. Find the magnitude and direction of the electric force on the charge at the origin. y 5.00 nC 0.100 m -3.00 nC 0.300 m 6.00 nC + x
-
In July 2021, Vio Bank was offering 0.61% interest on its money market account. Assuming interest is reinvested daily, find the associated exponential model for the value of a $3,000 deposit after t...
-
Noir is a French-based company which exports equipment to USA. Sales are forecasted for 10 000 units at EUR 40 per unit. Unit variable costs are EUR 22. The USD trades at USD 1.15/EUR. Noir forecasts...
-
The Proposed Runway 8L-26R should have one full-length parallel taxiway on the south side. Perform and document the FAA standard and perform the appropriate verification analysis to allow 787-8...
-
Table below shows number of people who work for the company, separated by age and gender, for M1,M2,F1,F2 use numbers assigned for you in the table below. Based on data in your table find different...
-
Explain the term global capital markets. This chapter primarily discusses global equity markets. What other types of financial instruments are traded in these markets? How important are global...
-
In your opinion, why is more than 60% of todays primary research data being generated by online self-reporting survey methods?
-
Use your statistical software package to obtain descriptive statistics for variables X1 to X8. Are the results similar or different from what your answers would be regarding an effective influencer?
-
How would you improve the social media influencer questionnaire?
Study smarter with the SolutionInn App