Inheritance - What is inheritance - Answer your own description in Readme.txt
Based on Hamburger project, you will create a package about Pizza.
In your Readme.txt, write how you make your Pizza package differently from the Hamburger package and also explain how inheritance work with your Pizza package.
package Hamburger;
/**
* Inheritance challenge – Hamburger place (Main, Hamburger, two
other Burger type class)
* Hamburger class should have name, bread roll type, meat, and up
to 4 additional
* additions(e.g. lettuce, tomato, carrot, etc)
* to select to be added to the burger. Each item will be charged an
additional
*/
public class Hamburger {
private String name;
//meat, price, breadRollType
private String meat;
private double price;
private String breadRollType;
private String additionName1;
private double additionPrice1;
private String additionName2;
private double additionPrice2;
private String additionName3;
private double additionPrice3;
private String additionName4;
private double additionPrice4;
public Hamburger(String name, String meat, double price, String
breadRollType) {
this.name = name;
this.meat = meat;
this.price = price;
this.breadRollType = breadRollType;
}
public void addHamburgerAddition1(String name, double
price){
this.additionName1 = name;
this.additionPrice1 = price;
}
public void addHamburgerAddition2(String name, double
price){
this.additionName2 = name;
this.additionPrice2 = price;
}
public void addHamburgerAddition3(String name, double
price){
this.additionName3 = name;
this.additionPrice3 = price;
}
public void addHamburgerAddition4(String name, double
price){
this.additionName4 = name;
this.additionPrice4 = price;
}
public double hamberPriceTotal(){
double hamburgerPrice = this.price;
System.out.println(this.name + " hambuger on a " + this.breadRollType + " roll with " + this.meat + "'s price is " + this.price);
if(this.additionName1 != null){
hamburgerPrice += this.additionPrice1;
System.out.println("Added " + this.additionName1 + " for an extra "
+ this.additionPrice1);
}
if(this.additionName2 != null){
hamburgerPrice += this.additionPrice2;
System.out.println("Added " + this.additionName2 + " for an extra "
+ this.additionPrice2);
}
if(this.additionName3 != null){
hamburgerPrice += this.additionPrice1;
System.out.println("Added " + this.additionName3 + " for an extra "
+ this.additionPrice3);
}
if(this.additionName4 != null){
hamburgerPrice += this.additionPrice4;
System.out.println("Added " + this.additionName4 + " for an extra "
+ this.additionPrice4);
}
return hamburgerPrice;
}
}
In: Computer Science
Inheritance - What is inheritance - Answer your own description in Readme.txt
Based on Hamburger project, you will create a package about Pizza.
In your Readme.txt, write how you make your Pizza package differently from the Hamburger package and also explain how inheritance work with your Pizza package.
package Hamburger;
/**
* Inheritance challenge – Hamburger place (Main, Hamburger, two
other Burger type class)
* Hamburger class should have name, bread roll type, meat, and up
to 4 additional
* additions(e.g. lettuce, tomato, carrot, etc)
* to select to be added to the burger. Each item will be charged an
additional
*/
public class Hamburger {
private String name;
//meat, price, breadRollType
private String meat;
private double price;
private String breadRollType;
private String additionName1;
private double additionPrice1;
private String additionName2;
private double additionPrice2;
private String additionName3;
private double additionPrice3;
private String additionName4;
private double additionPrice4;
public Hamburger(String name, String meat, double price, String
breadRollType) {
this.name = name;
this.meat = meat;
this.price = price;
this.breadRollType = breadRollType;
}
public void addHamburgerAddition1(String name, double
price){
this.additionName1 = name;
this.additionPrice1 = price;
}
public void addHamburgerAddition2(String name, double
price){
this.additionName2 = name;
this.additionPrice2 = price;
}
public void addHamburgerAddition3(String name, double
price){
this.additionName3 = name;
this.additionPrice3 = price;
}
public void addHamburgerAddition4(String name, double
price){
this.additionName4 = name;
this.additionPrice4 = price;
}
public double hamberPriceTotal(){
double hamburgerPrice = this.price;
System.out.println(this.name + " hambuger on a " + this.breadRollType + " roll with " + this.meat + "'s price is " + this.price);
if(this.additionName1 != null){
hamburgerPrice += this.additionPrice1;
System.out.println("Added " + this.additionName1 + " for an extra "
+ this.additionPrice1);
}
if(this.additionName2 != null){
hamburgerPrice += this.additionPrice2;
System.out.println("Added " + this.additionName2 + " for an extra "
+ this.additionPrice2);
}
if(this.additionName3 != null){
hamburgerPrice += this.additionPrice1;
System.out.println("Added " + this.additionName3 + " for an extra "
+ this.additionPrice3);
}
if(this.additionName4 != null){
hamburgerPrice += this.additionPrice4;
System.out.println("Added " + this.additionName4 + " for an extra "
+ this.additionPrice4);
}
return hamburgerPrice;
}
}
In: Computer Science
The requirements for this program are as follows:
Private members
a std::string for the employee’s first name
a std::string for the employee’s last name
an unsigned int for the employee’s identification number
a std::string for the city in which the employee works
Public members
A constructor that takes no arguments
A constructor that takes two arguments, representing:
A constructor that takes three arguments, representing:
A constructor that takes four arguments, representing:
A method named displayDetails() that takes no parameters, returns void, and is marked as const.
The displayDetails() method should display to the screen all of the information contained in the employee’s private data members.
All constructors should use constructor initializers to set the employee’s string data members. If a particular string is unknown (i.e., it’s not being passed into that constructor), set it to “unknown”.
For the two constructors that do not accept an argument for the identification number, use constructor initializers to set the identification number to 0.
Finally, write a simple driver file with a main() function. (An example is provided below; you may use this code but I'd recommend creating your own, for the sake of practice.) Inside main(), create at least six Employee objects by invoking the four different constructors. These objects should invoke the four different constructors and test the validity-checking of the identification number (so there will be two objects that invoke the three-argument constructor -- one of them should pass an invalid identification number, and the other should pass a valid number... followed by the same procedure for the four-argument constructor). For each object, invoke the displayDetails() method to test your program.
Example driver and output from that driver:
//inside Source.cpp
#include <iostream>
#include "Employee.h"
using namespace std;
int main()
{
Employee a;
Employee b{ "Robert", "Childan" };
Employee c{ "Nobusuke", "Tagomi", 83179391 };
Employee d{ "Ed", "McCarthy", 1 };
Employee e{ "Frank", "Frink", 73641933, "San
Francisco" };
Employee f{ "Juliana", "Frink", 2, "Canon City" };
a.displayDetails();
b.displayDetails();
c.displayDetails();
d.displayDetails();
e.displayDetails();
f.displayDetails();
}
//output from above driver
Employee Details:
First name: unknown
Last name: unknown
ID: 0
Office location: unknown
Employee Details:
First name: Robert
Last name: Childan
ID: 0
Office location: unknown
Employee Details:
First name: Nobusuke
Last name: Tagomi
ID: 0
Office location: unknown
Employee Details:
First name: Ed
Last name: McCarthy
ID: 1
Office location: unknown
Employee Details:
First name: Frank
Last name: Frink
ID: 0
Office location: San Francisco
Employee Details:
First name: Juliana
Last name: Frink
ID: 2
Office location: Canon City
///////////////////////////
Language: C++
Please ask questions if inftructions are unclear
In: Computer Science
Why would CuSO4 have a blue color after the iron reagent is added? Yes, the answer is because it is absorbing the other colors (the spectrophotometer), but WHAT is absorbing the other colors?
(Done in an experiment about spectrophotometry)
In: Chemistry
The number of bacteria after ? hours in a controlled laboratory experiment is ? = ?(?).
a. Describe the meaning of ?′(4) and include right units.
b. If the supply of nutrients is limited, which value do you think is larger ?′(4) or ?′(15)?
In: Math
In: Statistics and Probability
The following data was collected in an experiment. The initial amount of hydrogen peroxide is 0.0035 mol. Find the rate constant
Moles of O2 Time ( in minutes)
0.0000482 0.008
0.0003544 1.798
0.0006828 4.027
0.0010133 7.758
In: Chemistry
Question 4.
Describe an experiment to demonstrate whether the RNA folds into a functional tertiary structure of a ribozyme when the tetraloop region is deleted. You suspect that the tetraloop is critical for folding of a ribozyme into its active form.
In: Biology
A scientist wants to make a solution of tribasic sodium phosphate, Na3PO4, for a laboratory experiment. How many grams of Na3PO4 will be needed to produce 375 mL of a solution that has a concentration of Na+ ions of 1.50 M ?
In: Chemistry
In: Biology