EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
8th Edition
ISBN: 9781305480537
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 2, Problem 9PE

a.

Program Plan Intro

Chili Dinner

Program Plan:

  • Import the required java package.
  • Define the class “ChiliToGo”.
  • Define the main method.
    • Declare named constant variables.
    • Create a scanner class object to get user input.
    • Prompt the user to enter number of adult meals.
    • Convert the user input and store it in a variable.
    • Prompt the user to enter number of child meals.
    • Convert the user input and store it in a variable.
    • Compute total price of adult meals and child meals and the grand total.
    • Display total price of adult meals and child meals and the grand total.

b.

Program Plan Intro

Chili Dinner Profit

Program Plan:

  • Import the required java package.
  • Define the class “ChiliToGo”.
  • Define the main method.
    • Declare named constant variables.
    • Create a scanner class object to get user input.
    • Prompt the user to enter number of adult meals.
    • Convert the user input and store it in a variable.
    • Prompt the user to enter number of child meals.
    • Convert the user input and store it in a variable.
    • Compute total price of adult meals and child meals and the grand total.
    • Compute profit of adult meals and child meals and the grand total.
    • Display total price and profit of adult meals and child meals and the grand total.

Blurred answer
Students have asked these similar questions
Instructor note: This lab is part of the assignment for this chapter. This lab uses two Java files, LabProgram.java and SimpleCar.java. The SimpleCar class has been developed and provided to you already. You don't need to change anything in that class. Your job is to use the SimpleCar class to complete the specified tasks in the main() method of LabProgram.java Given two integers that represent the miles to drive forward and the miles to drive in reverse as user inputs, create a SimpleCar object that performs the following operations: Drives input number of miles forward Drives input number of miles in reverse Honks the horn Reports car status The SimpleCar class is found in the file SimpleCar.java. Ex: If the input is: 100 4 the output is: beep beep Car has driven: 96 miles
I need help with creating a Java program described below:   Trivia Game Create a simple trivia game for two players. The program will work like this: Starting with player 1, each player gets a turn at answering 5 trivia questions. (There are 10 questions, 5 for each player.) When a question is displayed, four possible answers are also displayed. Only one of the answers is correct, and if the player selects the correct answer, he or she earns a point. After answers have been selected for all of the questions, the program displays the number of points earned by each player and declares the player with the highest number of points the winner.                                                                  You are to design a Question class to hold the data for a trivia question. The Question class should have String fields for the following data: A trivia question Possible answer 1 Possible answer 2 Possible answer 3 Possible answer 4 The number of the correct answer (1, 2, 3, or 4)…
HangmanAA.java For this program, you will create the game Hangman. (If you are unsure of how to play Hangman, Google it.) The game will start by asking player 1 for a word or phrase (can be multiple words). Then player 1 will be asked how many missed guesses are allowed by player 2. Once this information is received, player 2 will take over. (Have the program print many blank lines of space so that player 2 can’t see what player 1 entered.) The instructions should be displayed for player 2 as well as the number of misses they’re allowed to make before they lose the game. The screen should also output dashes or underscores to represent each letter of player 1’s secret word/phrase. Player 2 should guess one letter at a time. Case should not matter. Typing x or X should give the same result. If that letter is present in the mystery phrase, then it should be displayed. (It will replace the dash/underscore in that spot. Spaces, punctuation, and all other non-alphabetic characters should…
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781305480537
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY