Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 11 Weeks Ago, 5 Days Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Java Program
Â
In this question, you will design an application for a company that creates personalized house signs to compute the prices of customer orders based on the following factors:
ï‚· The minimum charge (base price) for all type of sign is $20.
ï‚· If the sign is made of wood, add an extra charge $10, if it is a plastic, add an extra charge $5. No extra charge for aluminum.
ï‚· The first 5 letters or numbers are included in the minimum charge; there is an extra $2 charge for each additional character. (Space shouldn't be counted as a character.In order to check if a character is a space or not, you can use isSpaceChar()method of Character class.)
ï‚· Black or white characters are included in the minimum charge; there is an additional $8 charge for colored lettering.
ï‚· If the total charge is more than $100, provide 25 percent of discount on total price.
Â
Write a program that accepts data in the following order: order number, customer name, sign type(wood or plastic), the number of characters, and color of characters. The program should continue as long as a customer wants to order another sign.
Display all the entered data, number of the orders, and the final price for the customer to pay.* Note : You use a Scanner class's method (nextInt or nextDouble) to read a primitive value (int or double type values, respectively).
And then, if you use nextLine method toread a String, a problem (with hard-to-find reason) would occur. In this case, the Stringis never read from the keyboard (no chance for the user to enter a string) since thenextLine method is not designed to skip over an initial newline character.
Here are the solutions to overcome this problem: (For details, see the textbook Page88)1) Before getting user's input as a String, just consume the previous remaining newline using the following statement:keyboard.nextLine();OR2) Instead of using nextLine method, you can use next method to read a String