Question: Assume that the pseudocode below for each question is a separate working program in your organization and that it needs modifications as described in the
Assume that the pseudocode below for each question is a separate working program in your organization and that it needs modifications as described in the comments lines that begin with two slashes at the beginning of the code. Your job is to alter the pseudocode to meet the new specifications as noted above. Please follow directions as specified in the homework assignment instructions file. NOTE: If a function has no changes to be made to it then it will be in blue font.
This program accepts product data about products. It displays data about the most expensive product and the average price of all products.
Review the program to make sure it has no errors and that it properly uses a Product class to hold product data, and a constructor that
accepts all the data fields as parameters.
class Product
Declarations
private string idNum
private string description
private num price
public Productnum id string descrip, string pr
id idNum
description descrip
price pr
return
public void setIdNumstring id
idNum id
return
public void setDescriptionstring des
description desc
return
public void setPricenum pr
if pr
price
else
pr price
end
return pr
public string getIdNum
return idNum
public getDescription
return description
public num getPrice
return price
endClass
start
Declarations
num SIZE
Product products
num x
num total
num avg
num highestPrice
string highestId
string higestDescrip
while x SIZE
productsSIZE getData
total total productsSIZEgetPrice
if productsSIZEgetPrice highestPrice
highestPrice productsSIZEgetPrice
highestDesc productsSIZEgetHighest
highestId productsSIZEgetIdNum
endif
x x
end
avg total SIZE
output "The highest priced product is highestId,
highestDescrip, $ highestPrice
output "The average price of all products is $ avg
stop
Product getData
string id
string descrip
num price
output "Enter id or
output id
output "Enter description
output descrip
output "Enter price
output price
Product pid price, descrip
return p
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
