I wrote this below pseudo code which i think has issues, but i am willing to go
ID: 3537089 • Letter: I
Question
I wrote this below pseudo code which i think has issues, but i am willing to go with it. Below the code is the next part which i can not figure out how to begin......Any help would be great.
// Program Name: TelevisionClass
// Purpose: Pseudocode for defining a class
// Author: .......
// Date last Modified: ..........
Class TVInventory
Declare class variables
string Manufacturer // Manufacturers Name
FLoat Price // Retail Price
Float Size // Diagonal screen size
// Constructor method with three parameters
Manufacturer = Manufacturers Name
Price = Retail Price
Size = Diagonal screen size
End MEthod
end class
start
//define class
Display "Television Class."
Display "This program define television class."
void setPrice(Float price)
this.retailPrice = price;
void displayInfo(){
Output("Manufacturers are : ");
var i = 0;
for(i ; i< this.manufacturers.length ; i++)
Output(this.manufacturers[i]+" ");
Output("Screen Diagonal size is : "+this.screenDiagonalSize+ "inches");
Output("Retail Price is : "+retailPrice);
//close program
display "thanks"
Stop
The next part:
The store manager likes your class definition and wants you to test your logic by writing a program that creates Television object with Sony as the manufacturer, 52 as the screen size, and $1299.0 as the price. Your program should call the displayInfo() method to display information about the television and change the price to $999.00 by using the setPrice() method, then call the displayInfo() method again.
Using pseudocode, write a module creates an object from the Television class definition.
Explanation / Answer
class TVInventory{
String Manufacturer ; // Manufacturers Name
float Price ; // Retail Price
float Size; // Diagonal screen size
// Constructor method with three parameters
TVInventory(String a, float b, float c)
{
Manufacturer = a;
Price = b;
Size =c;
}
}
class Television
{ TVInventory mytv = new TVInventory("Sony",52.0f,1299.0f);
void setPrice(float price)
{mytv.Price= price;}
void displayInfo(){
System.out.print("Manufacturers are : ");
System.out.print(mytv.Manufacturer +" ");
System.out.println("Screen Diagonal size is : "+mytv.Size+ "inches");
System.out.println("Retail Price is : "+mytv.Price);
}
public static void main(String args[])
{
TVInventory mytv = new TVInventory("Sony",52.0f,1299.0f);
Television myt =new Television();
myt.displayInfo();
myt.setPrice(999.00f);
myt.displayInfo();
}
}