Java Programming
Java Programming
8th Edition
ISBN: 9781305981829
Author: Joyce Farrell
Publisher: Cengage Limited
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
The Huntington Boys and Girls Club is conducting a fundraiser by selling chili dinners to go. The selling price is Rs.7 for an adult meal and Rs.4 for a child's meal. Write a class that accepts the number of each type of meal ordered and display the total money collected for adult meals, children's meals, and all meals. Moreover, assume the cost price to produce an adult meal and a child's meal are Rs.4.35 and Rs. 3.10, respectively. Further, create a method to display the total profit for each type of meal as well as the grand total profit. Use java
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…
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