Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 303 Weeks Ago, 3 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 22 Sep 2017 My Price 9.00

additional unique feature

Inventory Program Part 3
Modify the Inventory Program by creating a subclass of the product class that uses one additional unique feature of the product you chose (for the DVDs subclass, you could use movie title, for example). In the subclass, create a method to calculate the value of the inventory of a product with the same name as the method previously created for the product class. The subclass method should also add a 5% restocking fee to the value of the inventory of that product.
Modify the output to display this additional feature you have chosen and the restocking fee.
Post as an attachment - This should be a text file with a .java extension.
// stores a collection of software
public class InventoryPart2 {

public static void main(String[] args) {

// create 3 products
Product p1 = new Product(1, "Windows", 3, 164.99);
Product p2 = new Product(2, "Mac OS", 5, 189.99);
Product p3 = new Product(3, "Linux", 4, 129.99);

// make inventory
Inventory i = new Inventory(3);
i.add(p1, 0);
i.add(p2, 1);
i.add(p3, 2);

// sort
i.sort();

// output the products using proper formatting, with a header row
// the columns are spaced using tabs to look nice
System.out.println("Number\tName\tUnits\tPrice\tVal");
for (int k = 0; k
System.out.println(i.get(k));
}

System.out.println();
// total val
System.out.printf("Total value = $%.2f", i.totalValue());
}

}


public class Product {

private int number;
private String name;
private int units;
private double price;

// constructor
public Product(int number, String name, int units, double price) {
this.number = number;
this.name = name;
this.units = units;
this.price = price;
}

// value of this product
public double calculateInventory() {
return price*units;
}

/**
* returns the number
*/
public int getNumber() {
return number;
}

/**
* sets the number
*/
public void setNumber(int number) {
this.number = number;
}

/**
* returns the name
*/
public String getName() {
return name;
}

/**
* sets the name
*/
public void setName(String name) {
this.name = name;
}

/**
* returns the units
*/
public int getUnits() {
return units;
}

/**
* sets the units
*/
public void setUnits(int units) {
this.units = units;
}

/**
* returns the price
*/
public double getPrice() {
return price;
}

/**
* sets the price
*/
public void setPrice(double price) {
this.price = price;
}

// returns it as a string
public String toString() {
return String.format(" %03d %-10s %3d $%6.2f $%7.2f",
number, name, units, price, calculateInventory());
}



}

Answers

(5)
Status NEW Posted 22 Sep 2017 08:09 PM My Price 9.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)