Solution
Snehil answered on
May 05 2020
Camera.java
Camera.java
Class define a camera
public class Camera extends Product
{
private int pixelCount;
constructo
public Camera(int wa
anty, String
andName, float screenSize, int pixelCount)
{
super(wa
anty,
andName, screenSize);
this.pixelCount = pixelCount;
}
getters and setters
public int getPixelCount()
{
return pixelCount;
}
public void setPixelCount(int pixelCount)
{
this.pixelCount = pixelCount;
}
Method to convert values to string for printing purposes
public String toString()
{
return "2," + getWa
anty() + "," + getBrandName() + "," + getScreenSize() + "," + getPixelCount() + ",1";
}
}
Mobile.java
Mobile.java
Class define a Mobile
public class Mobile extends Product
{
private String color;
private int storage;
constructo
public Mobile(int wa
anty, String
andName, float screenSize, int storage, String color)
{
super(wa
anty,
andName, screenSize);
this.color = color;
this.storage = storage;
}
getters and setters
public String getColor()
{
return color;
}
public void setColor(String color)
{
this.color = color;
}
public int getStorage()
{
return storage;
}
public void setStorage(int storage)
{
this.storage = storage;
}
Method to convert values to string for printing purposes
public String toString()
{
return "1," + getWa
anty() + "," + getBrandName() + "," + getScreenSize() + "," + getStorage() + ","
+ getColor() + ",1";
}
}
orders1.txt
1,10
2,20
3,10
1,5
1,15
3,50
orders2.txt
2,10
1,20
1,10
2,5
3,15
2,50
Product.java
Product.java
Class define a base product which will be used for inheritance
public class Product
{
private int wa
anty;
private String
andName;
private float screenSize;
constructo
public Product(int wa
anty, String
andName, float screenSize)
{
this.wa
anty = wa
anty;
this.
andName =
andName;
this.screenSize = screenSize;
}
getters and setters
public int getWa
anty()
{
return wa
anty;
}
public void setWa
anty(int wa
anty)
{
this.wa
anty = wa
anty;
}
public String getBrandName()
{
return
andName;
}
public void setBrandName(String
andName)
{
this.
andName =
andName;
}
public float getScreenSize()
{
return screenSize;
}
public void setScreenSize(float screenSize)
{
this.screenSize = screenSize;
}
}
Report.docx
Class Product
base product which will be used for inheritance
Variables
Scope
String
and
private
int wa
anty
private
float screenSize
private
Methods
Parameters and return type
Product
Takes int,String,float. Has no return type.
getWa
anty
Takes nothing returns int
setWa
anty
Takes int returns nothing
getBrandName
Takes nothing returns String
setBrandName
Takes String returns nothing
getWa
anty
Takes nothing returns int
getScreenSize
Takes nothing returns float
setScreenSize
Takes float returns nothing
getWa
anty
Class Mobile
define a Mobile
Variables
Scope
String colo
private
int storageCapacity
private
Methods
Parameters and return type
Mobile
Takes int,String,float,int,String. Has no return type.
getStorage
Takes nothing returns int
setStorage
Takes int returns nothing
getColo
Takes nothing returns String
setColo
Takes String returns nothing
Class Camera
define a Camera
Variables
Scope
int numPixels
private
Methods
Parameters and return type
Camera
Takes int,String,float,int. Has no return type.
getPixelCount
Takes nothing returns int
setPixelCount
Takes int returns nothing
Class Tablet
define a Tablet
Variables
Scope
String operatingSystem
private
int storageCapacity
private
Methods
Parameters and return type
Tablet
Takes...