EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Question
Chapter 5, Problem 3PE
a.
Program Plan Intro
Determine the price of a selected room
Program plan:
- Import necessary package.
- Create a class “ShadyRestRoom”,
- Define the method “main ()”,
- Declare the necessary variables.
- Declare the necessary final variables.
- Create “Scanner” object.
- Print the menu.
- Prompt the user to enter the choice.
- Get the choice from the user using “nextInt()”.
- Check whether the choice is queen,
- Assign the corresponding text for a queen.
- Assign the corresponding price for a room.
- Otherwise, check whether the choice is a king,
- Assign the corresponding text for a king.
- Assign the corresponding price for a room.
- Otherwise, check whether the choice is a suite,
- Assign the corresponding text for a suite.
- Assign the corresponding price for a suite.
- Otherwise,
- Assign the invalid text.
- Set the price value to “0”.
- Print the output.
- Define the method “main ()”,
b.
Program Plan Intro
Determine the price of a selected view
Program plan:
- Import necessary package.
- Create a class “ShadyRestRoom2”,
- Define the method “main ()”,
- Declare the necessary variables.
- Declare the necessary final variables.
- Create “Scanner” object.
- Print the menu.
- Prompt the user to enter the choice.
- Get the choice from the user using “nextInt()”.
- Check whether the choice is queen,
- Assign the corresponding text for a queen.
- Assign the corresponding price for a room.
- Otherwise, check whether the choice is a king,
- Assign the corresponding text for a king.
- Assign the corresponding price for a room.
- Otherwise, check whether the choice is a suite,
- Assign the corresponding text for a suite.
- Assign the corresponding price for a suite.
- Otherwise,
- Assign the invalid text.
- Set the price value to “0”.
- Check whether the price is not equal to “0”,
- Prompt the user to enter the view.
- Print the view and the corresponding text.
- Prompt the user to enter the choice of view.
- Get the view choice from the user.
- Check whether the choice is lake,
- If it is true, assign the corresponding text for a lake.
- Update the price.
-
- Otherwise, check whether the choice is a park,
- If it is true, assign the corresponding text for a park.
- Otherwise,
- Update the price.
- Assign the error text message.
- Otherwise, check whether the choice is a park,
- Print the output.
- Define the method “main ()”,
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Write a standard mode application for the Summerdale Condo Sales Office; the program determines the price of a condominium. Ask the user to choose 1 for park view, 2 for golf course view, 3 for lake view. The output is the name of the chosen view as well as the price of the condo. Park view condos are $150,000, condos with golf course views are $170,000, and condos with lake views are $210,000. If the user enters an invalid code, set the price to 0. Save the file as CondoSales.java.
Add a prompt to the CondoSales application to ask the user to specify a (1) garage or a (2) parking space, but only if the view selection is valid. Add $5,000 to the price of any condo with a garage. If the parking value is invalid, display an appropriate message and assume that the price is for a condo with no garage. Save the file as CondoSales2.java.
Write an application that prompts the user for two integers and then prompts the user to enter an option as follows: 1 to add the two integers, 2 to subtract the second integer from the first, 3 to multiply the integers, and 4 to divide the first integer by the second. Display an error message if the user enters an option other than 1 through 4 or if the user chooses the divide option but enters 0 for the second integer. Otherwise, display the results of the arithmetic.
Write an application that allows a user to enter any number of student test scores until the user enters 999. If the score entered is less than 0 or more than 100, display an appropriate message and do not use the score. After all the scores have been entered, display the number of scores entered, the highest score, the lowest score, and the arithmetic average. Save the file as TestScoreStatistics.cpp.
Chapter 5 Solutions
EBK JAVA PROGRAMMING
Ch. 5 - Prob. 1RQCh. 5 - Prob. 2RQCh. 5 - Prob. 3RQCh. 5 - Prob. 4RQCh. 5 - Prob. 5RQCh. 5 - Prob. 6RQCh. 5 - Prob. 7RQCh. 5 - Prob. 8RQCh. 5 - Prob. 9RQCh. 5 - Prob. 10RQ
Ch. 5 - Prob. 11RQCh. 5 - Prob. 12RQCh. 5 - Prob. 13RQCh. 5 - Prob. 14RQCh. 5 - Prob. 16RQCh. 5 - Prob. 17RQCh. 5 - Prob. 18RQCh. 5 - Prob. 19RQCh. 5 - Prob. 20RQCh. 5 - Prob. 1PECh. 5 - Prob. 2PECh. 5 - Prob. 3PECh. 5 - Prob. 4PECh. 5 - Prob. 5PECh. 5 - Prob. 6PECh. 5 - Prob. 7PECh. 5 - Prob. 8PECh. 5 - Prob. 9PECh. 5 - Prob. 10PECh. 5 - Prob. 1GZCh. 5 - Prob. 2GZCh. 5 - Prob. 3GZCh. 5 - Prob. 4GZCh. 5 - Prob. 5GZ
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In previous chapters, you created applications for the Greenville Idol competition. Now, modify the version of the GreenvilleRevenue program created in Chapter 5 so that after the user enters the number of contestants in this competition, the user is prompted for the appropriate number of contestant names and a code for each contestant that indicates the type of talent: S for singing, D for dancing, M for playing a musical instrument, or O for other. Make sure that all entered codes are valid, and if not, reprompt the user to enter a correct code. After contestant data entry is complete, display a count of each type of talent. Then, continuously prompt the user for a talent code until the user enters a sentinel value. With each code entry, display a list of the contestants with that code, or display a message that the code is not valid and reprompt the user.arrow_forwardHere is my assignment that must be in C#: Write an application named EnterUppercaseLetters that asks the user to type an uppercase letter from the keyboard. If the character entered is an uppercase letter, display: OK; if it is not an uppercase letter, display the error message: Sorry - that was not an uppercase letter. . The program continues until the user types an exclamation point (!). An example of the program is shown below:arrow_forwardWrite an application that allows a user to enter any number of student quiz scores, as integers, until the user enters 99. If the score entered is less than 0 or more than 10, display Score must be between 10 and 0 and do not use the score. After all the scores have been entered, display the number of valid scores entered, the highest score, the lowest score, and the arithmetic average.arrow_forward
- . Write an application for a college’s admissions office. Prompt the user for a student’s numeric high school grade point average (for example, 3.2) and an admission test score from 0 to 100. Display the message “Accept” if the student has any of the following: A grade point average of 3.0 or above and an admission test score of at least 60arrow_forwardWrite a program named Testslnteractive that prompts a user for eight test scores and displays the average of the test scores to two decimal places.arrow_forward. Write an application for a college’s admissions office. Prompt the user for a student’s numeric high school grade point average (for example, 3.2) and an admission test score from 0 to 100. Display the message “Accept” if the student has any of the following: A grade point average below 3.0 and an admission test score of at least 80 If the student does not meet either of the qualification criteria, display “Reject”. Save the file as Admission.java.arrow_forward
- Write a program that prompts the user to enter twocharacters and displays the major and status represented in the characters. The firstcharacter indicates the major and the second is number character 1, 2, 3, 4, whichindicates whether a student is a freshman, sophomore, junior, or senior. Supposethe following characters are used to denote the majors:I: Information ManagementC: Computer ScienceA: Accounting Here is a sample run: Enter two characters: I1 ↵EnterInformation Management Freshmanarrow_forwardIn previous chapters, you created applications for the Greenville Idol competition. Now, modify your version of the GreenvilleRevenue program created in Chapter 5 so that after the user enters the number of contestants in this year’s competition, the user is prompted for the appropriate number of contestant names and a code for each contestant that indicates the type of talent: S for singing D for dancing M for playing a musical instrument O for other. Make sure that all entered codes are valid, and if not, re-prompt the user to enter a correct code. For example, if Y is input, output Y is not a valid code, and re-prompt the user until a valid code is entered. After contestant data entry is complete, display a count of each type of talent. For example, if there were ten singers, four dancers, seven people who play musical instruments, and one in the other category, the output should be: The types of talent are: Singing 10 Dancing 4 Musical instrument 7 Other 1 Then, continuously…arrow_forwardIn previous chapters, you created applications for the Greenville Idol competition. Now, modify your version of the GreenvilleRevenue program created in Chapter 5 so that after the user enters the number of contestants in this year’s competition, the user is prompted for the appropriate number of contestant names and a code for each contestant that indicates the type of talent: S for singing D for dancing M for playing a musical instrument O for other. Make sure that all entered codes are valid, and if not, re-prompt the user to enter a correct code. For example, if Y is input, output Y is not a valid code, and re-prompt the user until a valid code is entered. After contestant data entry is complete, display a count of each type of talent. For example, if there were ten singers, four dancers, seven people who play musical instruments, and one in the other category, the output should be: The types of talent are: Singing 10 Dancing 4 Musical instrument 7 Other 1 Then, continuously…arrow_forward
- You are a manager of a Wally's Training Gym and you encourage your trainers to enroll new members. Input is the trainer's last name and the number of new enrollees, and names of each new member. Output is the number of trainers who have enrolled members in each of three categories: 0-5 new members, 6-10 new members, and 11 to 15 new members, as well as the names of each new enrollee. Write an application that allows the user to enter any number Trainer's names, number of new members, and names of each new member. Output is to display the names of trainers who are in each category, and the new members enrolled. Use good programming techniques and use appropriate variable names, use an array to store the names and number of new enrollees, and use prompts for the input and labels with the display. Write your program using Python. You may use a free version of Python at Replit. com Both header comments and step comments are encouraged as it will help for logic to be better. Header…arrow_forwardWrite an application that prompts the user for two integers and then prompts the user to enter an option. If the choice is 1, add the two integers. If it is 2, subtract the second integer from the first; if it is 3, multiply the integers. Display the results of the arithmetic.arrow_forward3) You are asked to write a program which draws a house with a roof based on the following specifications (Using C++).Application name: Display a welcome bannerA) Welcome user: Ask the user for their name and using their name welcome them to your application.B) Request house dimensions and validate input: Ask the user to enter the width and height of the house to be drawn (Note: Both height and width are integer). The width must be even and bigger than 2. If the user enters odd numbers or a number less than or equal to 2 for the width, you are required to prompt the user until they enter an even number. They have 3 tries for entering width. If after 3 tries they are still entering odd numbers terminate your program with an appropriate personalized message otherwise move on to step C. C) Draw the house: i.The roof consists of a set of stars on each row. Number of stars in the last row of the roof is equal to the width of the house. The first row starts with two stars and you increase…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
C - File I/O; Author: Tutorials Point (India) Ltd.;https://www.youtube.com/watch?v=cEfuwpbGi1k;License: Standard YouTube License, CC-BY
file handling functions in c | fprintf, fscanf, fread, fwrite |; Author: Education 4u;https://www.youtube.com/watch?v=aqeXS1bJihA;License: Standard Youtube License