Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i have to write a program for a car show room with the car and inventory i have

ID: 3838032 • Letter: I

Question

i have to write a program for a car show room with the car and inventory

i have the inventory and the car class please make me the program

// the inventory class

public class InventoryItem {

private int NewCars;
private String Refill;
private double Totalsales;
private int TotCarsSold;

public InventoryItem (int NewCars, String Refill, double Totalsales, int TotCarsSold) {

this.NewCars = NewCars;
this.Refill = Refill;
this.Totalsales = Totalsales;
this.TotCarsSold = TotCarsSold;

}

public int getNewCars() {

return NewCars;

}


public String getRefill () {

return Refill;

}

public void setTotalsales (double Totalsales) {

this.Totalsales = Totalsales;

}   

public double getTotalsales () {

return Totalsales;

}

public void setTotCarsSold(int TotCarsSold) {

this.TotCarsSold = TotCarsSold;

}


public int getTotCarsSold() {

return TotCarsSold;

}
@Override
public String toString() {

return String.format("[%d ,%s ,%1.2f ,%d]", NewCars, Refill, Totalsales, TotCarsSold);

}

public static void main(String[] args) {
InventoryItem Refill = new InventoryItem(1, "asdf", 2.4, 5);
System.out.println(Refill);

}

}

Warehouse.java-

InventoryItem.java -

public class InventoryItem {

private int NewCars;
private String Refill;
private double Totalsales;
private int TotCarsSold;

public InventoryItem (int NewCars, String Refill, double Totalsales, int TotCarsSold) {

this.NewCars = NewCars;
this.Refill = Refill;
this.Totalsales = Totalsales;
this.TotCarsSold = TotCarsSold;

}

public int getNewCars() {

return NewCars;

}


public String getRefill () {

return Refill;

}

public void setTotalsales (double Totalsales) {

this.Totalsales = Totalsales;

}   

public double getTotalsales () {

return Totalsales;

}

public void setTotCarsSold(int TotCarsSold) {

this.TotCarsSold = TotCarsSold;

}


public int getTotCarsSold() {

return TotCarsSold;

}
@Override
public String toString() {

return String.format("[%d ,%s ,%1.2f ,%d]", NewCars, Refill, Totalsales, TotCarsSold);

}

public static void main(String[] args) {
InventoryItem Refill = new InventoryItem(1, "asdf", 2.4, 5);
System.out.println(Refill);

}

}


Warehouse.java

import java.util.ArrayList;
import java.util.List;

public class Warehouse {
private List<InventoryItem> inventory = new ArrayList<InventoryItem>();

public void addItem(InventoryItem i) {
inventory.add(i);
}

public static void main(String [] args) {
// create a Warehouse instance
Warehouse warehouse = new Warehouse();
// create an InventoryItem instance

int NewCars= 111;
String Refill = "Y";
double Totalsales= 120000.0;
int TotCarsSold= 2000;

InventoryItem i = new InventoryItem(sku, itemName, price, stock);
// add the InventoryItem to the Warehouse
warehouse.addItem(i);
}
}

//car class

public class Car{
public String model;
public Integer sellerPrice;
  
public String getModel(){
return model;
}
public void setModel(String model) {
this.model = model;
}
  
public Integer getSellerPrice() {
return sellerPrice;
}
  
public void setSellerPrice(Integer sellerPrice) {
this.sellerPrice = sellerPrice;
}
public Integer getOurPrice() {
return OurPrice;
}
  
public void setOurPrice(Integer ourPrice){
OurPrice = ourPrice;
}
  
public String getMake() {
return make;
}
public void setMake(String make){
this.make = make;
}
public Integer OurPrice;
public String make;
}
  

Explanation / Answer

public class Showroom {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        Warehouse warehouse = new Warehouse();
        // create an InventoryItem instance
        InventoryItem item = null;
        Car c=new Car();
        int choice,nc,ts,tcs;
        String rf=null;
        do{
            System.out.println("Option Available");
            System.out.println("1. Get Car Details");
            System.out.println("2. Input Car Details");
            System.out.println("3. Check inventory ");
            System.out.println("4. Input inventory ");
            System.out.print("Select choice :");
            choice=input.nextInt();
            switch(choice){
                case 1:
                    System.out.println("Model : "+c.model+"Seller Price: "+c.sellerPrice+"Our Price: "+c.ourPrice+"Make: "+c.make);
                    break;
                case 2:
                    System.out.print("Car model:    ");
                    c.setModel(input.next());
                    System.out.print("Seller Price: ");
                    c.setSellerPrice(input.nextInt());
                    System.out.print("Our Price:    ");
                    c.setOurPrice(input.nextInt());
                    System.out.print("Car model:    ");
                    c.setMake(input.next());
                    break;
                case 3:
                    System.out.print("New Car:    ");
                    nc=input.nextInt();
                    System.out.print("Refill:    ");
                    rf=input.next();
                    System.out.print("Total sale:    ");
                    ts=input.nextInt();
                    System.out.print("Total car solds:    ");
                    tcs=input.nextInt();
                    item = new InventoryItem(nc,rf,ts,tcs);
                    break;
                case 4:
                    warehouse.addItem(item);
                    break;
                case 5:
                    System.exit(0);
            }
        }while(choice!=5);
    }