Demonstrate your work

Assignment Help Computer Engineering
Reference no: EM132200518

Write a Java application that meets the following specifications. Make sure to give the classes and methods the exact names shown in this prompt, since I will be testing them using my own test class.

The abstract class Pizza has two subclasses Pizza, namely TypeAPizza and TypeBPizza.

TypeAPizzas are round and weigh 25 grams per square centimeter, while TypeBPizzas are square and weigh 50 grams per square centimeter.

Every Pizza initially has ten slices with equal areas. Each Pizza contains zero or more toppings, stored in a list. Each topping name is a String. Think about what other variables you need.

Every Pizza has the following methods. At least one of these methods should be abstract in Pizza, but I have not indicated which one(s):

public void addTopping(String t) adds a topping to the pizza

public boolean checkTopping(String t) returns true if the pizza has a particular topping, otherwise false. Think carefully about the String comparisons.

public Double getCurrentAreaInSqCM() returns the current surface area in square CM

public double getCurrentWeightInGrams() returns the current weight of the pizza in grams

public double eatSlice() returns the weight of one slice if one is available; otherwise returns zero. Also does whatever is necessary to ensure that future calls to getCurrentAreaInSqCM() and getCurrentWeightInGrams() will reflect the reduced amount of pizza remaining.

Each type of Pizza needs a constructor. Think carefully about the parameters. Hint: Remember that variables that are protected, rather than private, in Pizza can be accessed from the subclasses.

You do not need to take user input for this problem. Use a driver class to thoroughly demonstrate your work. The driver class should create Pizzas of various sizes and demonstrate that all the methods work correctly.

Reference no: EM132200518

Questions Cloud

Read an input file containing text and a single word : Write a Java application that reads an input file containing text and a single word.
Prompt the user for pairs of inputs of a product number : Write a Java application that prompts the user for pairs of inputs of a product number (1-5), and then an integer quantity of units sold.
Write a code program with a loop that lets the user enter : Write a java code program with a loop that lets the user enter a series of positive integers.
Calculate the time required for each of three trip : Prompts the user for destination, number of miles driven, and speed driven (both as integer values).
Demonstrate your work : The driver class should create Pizzas of various sizes and demonstrate that all the methods work correctly.
Check whether an array of integers is gigantic not : Write a Java method that checks whether an array of integers is gigantic not.
Write a method that creates an array of ten doubles : Write a method that creates an array of ten doubles, initializes it with ten values taken from console input and returns a reference to the array.
Explain the common ion effect : Explain the common ion effect. Explain the relationship between Ka for an acid and Kb for its conjugate base.
Write a java program to accept positive integers from user : Write a Java program to accept positive integers from the user at the command line. The user can enter as many integers as they like. Use -1 as a sentinel.

Reviews

Write a Review

Computer Engineering Questions & Answers

  How can the forensic artifacts be retrieved

There are many potential sources of digital evidence in a corporate setting. Where are places an investigator may find information beyond a computer workstation

  Write an application that prints the integer numbers

Write an application that prints the integer numbers from 1 to 60 along-with the square root value of only even numbers.

  What factors will influence the team

Considering the technical skills required, do you think it is feasible to have a CSIRT response team consisting of employees with other job duties.

  How does implementation differ for product innovation and

how culture affects innovationthe discussion of how different countries governments are involved in the innovation

  Express the role of each table

Propose the design of a database. Explain the role of each table in your proposed database and the relationships between the tables.

  Show the result of each pseudocode program

Show the result of each pseudocode program. Also rewrite pseudocode statements using Assignment statements. Given a simple business program that requires iteration, create a solution algorithm that employs loops.

  Program that help an elementary school learn multiplication

Computers are playing an increasing role in education. Write a program that will help an elementary school learn multiplication. make Use of a Random object to produce two positive one-digit integers.

  Create private static int variables

If the instructions tell you to use a certain variable or method name, use that specific name.

  Write and execute and turn in a program to read angles

Write and execute and turn in (as screen captures) a program to read in the three angles of a triangle and print if the triangle is a valid one or not.

  How many banks does memory have

Similar to problem 10 on page 282, assume we have an 8G times 64 word addressable computer built using 512M times 32 chips.

  Explain why the set location method need not be overridden

Explain why the set Location method need not be overridden in the subclass. Why is it nevertheless not a good idea to have Circle inherit from Point?

  What is translatinal look-aside buffer

What is Translatinal look-aside buffer (TLB)? What is it for? What is stored in this memory?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd