Java Programming
Java Programming
8th Edition
ISBN: 9781305981829
Author: Joyce Farrell
Publisher: Cengage Limited
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 4, Problem 5PE

a.

Program Plan Intro

Bread

Program Plan:

Bread.java:

  • Define the class “Bread”.
    • Declare and initialize the required variable.
    • Definition of constructor.
      • Assign the “bread” and “cal” to the “breadName” and “calories”.
      • Definition of “getBreadType()”.
        • Return the value of “breadName”.
      • Definition of method “getCaloriesPerSlice()”
        • Return the value of “calories”

BreadTest.java:

  • Define the class “BreadTest”.
    • Define the main method.
      • Create an object for bread.
      • Call the method bread.
    • Definition of method “display()”.
      • Get the type of bread and calories per slice by calling the method “getBreadType()” and “getCaloriesPerSlice()”.
      • Print the result.

b.

Program Plan Intro

SandwichFilling.java

Program Plan:

SandwichFilling.java:

  • Define the class “SandwichFilling”.
    • Declare and initialize the required variable.
    • Definition of constructor.
      • Assign the “fill” and “calories” value to the variables.
    • Definition of method “getSandwichFilling()”.
      • Return the value filling.
    • Definition of method “getCalories()”.
      • Return the value calories.

TestSandwichFilling.java:

  • Define the class “TestSandwichFilling”.
    • Define the main method.
      • Create an object for “SandwichFilling”.
      • Call the method “display()”.
    • Definition of method “display()”.
      • Get the type of sandwich filling and calories per slice by calling the method “getSandwichFilling()” and “getCalories()”.
      • Print the result.

c.

Program Plan Intro

Sandwich.java

Program Plan:

Sandwich.java:

  • Define the class “SandwichFilling”.
    • Declare and initialize the required variable.
    • Definition of constructor.
      • Assign the “Bread” and “Sandwich” value to the variables.
    • Definition of method “getBread()”.
      • Return the value filling.
    • Definition of method “getSandwich()”.
      • Return the value calories.

TestSandwichFilling.java:

  • Define the class “TestSandwich”.
    • Define the main method.
      • Create an object for “Sandwich”.
      • Call the method “display()”.
    • Definition of method “display()”.
      • Declare the variable “SLICE”.
      • Create an object for “Bread”.
      • Create an object for “SandwichFilling”.
      • Print the details of bread.
      • Print the details of “sandwichFilling”.
      • Print the details of “sandwich”

Blurred answer
Students have asked these similar questions
This is a question that I have and would like someone who has experiences with scene graphs and entity component systems to answer.For context, I am currently implementing a game engine and currently I am debating on our current design.Our current design is we have a singular game component class that every component inherits from. Where we have components like SpriteRendererComponent, Mehs Component, etc. They inherit from this GameComponent class. The point of this is being able to have O(1) access to the scene to being able to modify components to attach more components with the idea of accessing those components to specific scene objects in a scene.Now, my question is what kinds of caveauts can this cause in terms of cache coherence? I am well aware that yes its O(1) and that is great but cache coherence is going to be really bad, but would like to know more explicit details and real-life examples such as write in RAM examples on how this is bad. A follow-up question that is part…
Q4: Consider the following MAILORDER relational schema describing the data for a mail order company. (Choose five only). PARTS(Pno, Pname, Qoh, Price, Olevel) CUSTOMERS(Cno, Cname, Street, Zip, Phone) EMPLOYEES(Eno, Ename, Zip, Hdate) ZIP CODES(Zip, City) ORDERS(Ono, Cno, Eno, Received, Shipped) ODETAILS(Ono, Pno, Qty) (10 Marks) I want a detailed explanation to understand the mechanism how it is Qoh stands for quantity on hand: the other attribute names are self-explanatory. Specify and execute the following queries using the RA interpreter on the MAILORDER database schema. a. Retrieve the names of parts that cost less than $20.00. b. Retrieve the names and cities of employees who have taken orders for parts costing more than $50.00. c. Retrieve the pairs of customer number values of customers who live in the same ZIP Code. d. Retrieve the names of customers who have ordered parts from employees living in Wichita. e. Retrieve the names of customers who have ordered parts costing less…
Q4: Consider the following MAILORDER relational schema describing the data for a mail order company. (Choose five only). (10 Marks) PARTS(Pno, Pname, Qoh, Price, Olevel) CUSTOMERS(Cno, Cname, Street, Zip, Phone) EMPLOYEES(Eno, Ename, Zip, Hdate) ZIP CODES(Zip, City) ORDERS(Ono, Cno, Eno, Received, Shipped) ODETAILS(Ono, Pno, Qty) Qoh stands for quantity on hand: the other attribute names are self-explanatory. Specify and execute the following queries using the RA interpreter on the MAILORDER database schema. a. Retrieve the names of parts that cost less than $20.00. b. Retrieve the names and cities of employees who have taken orders for parts costing more than $50.00. c. Retrieve the pairs of customer number values of customers who live in the same ZIP Code. d. Retrieve the names of customers who have ordered parts from employees living in Wichita. e. Retrieve the names of customers who have ordered parts costing less than$20.00. f. Retrieve the names of customers who have not placed…
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:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
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