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
Use the scenario below for help answering 1(A), (B) and (C). This is using Java. The Scenario: You have a class named HeartsPlayer A round of Hearts starts with every player having 13 cards Players then choose 3 cards to “trade” with a player (1st you pass left, 2nd you pass right, 3rd you pass across, 4th you keep) Players then strategically play cards in order to have the lowest score At the end of the round, points are cumulatively totaled for each player. If one player’s total is greater than 100, the game ends and the player with the lowest score wins. Guide: Static & Not Final Field: Accessed by every object, Changing Non-Static & Final Field: Accessed by object itself, Non-Changing Static & Final: Accessed by every object, Non-Changing Non-Static & Not Final Field: Accessed by object itself, Changing 1. How should the following data fields be defined (with respect to final and static)? (a) playerPosition (These have values of North, South, East, or West)- Is…
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)…
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