In: Computer Science
a. Design a class named ItemForSale that holds data
about items placed for sale on Carlos's List, a classified
advertising website. Fields include an ad number, item description,
asking price, and phone number. Include get and set methods for
each field. Include a static method that displays the website's
motto ("Sell Stuff Locally!"). Include two overloaded constructors
as follows: A default constructor that sets the ad number to 101,
the asking price to $1, and the item description and phone number
both to XXX A constructor that allows you to pass values for all
four fields Create the class diagram and write the pseudocode that
defines the class.
b. Design an application that declares two ItemForSale
objects using a different constructor version with each object.
Display each ItemForSale's values and then display the motto.
I need this in basic pseudocode, not Java. having a real thought
time trying to get this one right! Thank you
PSEUDOCODE :-
Part a -
Class Diagram -
Part b -
TEXT PSEUDOCODE :-
Part a -
class ItemForSale
private:
integer adNumber;
string itemDescription;
double askingPrice;
string phoneNumber;
public:
ItemForSale()
this->adNumber = 101;
this->itemDescription =
"XXX";
this->askingPrice = 1;
this->phoneNumber = "XXX";
ItemForSale(adNumber,itemDescription,askingPrice,phoneNumber)
this->adNumber = adNumber;
this->itemDescription =
itemDescription;
this->askingPrice =
askingPrice;
this->phoneNumber =
phoneNumber;
void setAdNumber(adNumber)
this->adNumber = adNumber;
void setItemDescription(itemDescription)
this->itemDescription =
itemDescription;
void setAskingPrice(askingPrice)
this->askingPrice =
askingPrice;
void setPhoneNumber(phoneNumber)
this->phoneNumber =
phoneNumber;
integer getAdNumber()
return this->adNumber;
string getItemDescription()
return
this->itemDescription;
double getAskingPrice()
return this->askingPrice;
string getPhoneNumber()
return this->phoneNumber;
static void displayMotto()
cout << "Sell Stuff
Locally!";
Part b -
main()
ItemForSale itemOne;
ItemForSale itemTwo(102,"Test
Item",45,"989797563");
cout << itemOne.getAskingPrice() <<
endl;
itemOne.displayMotto();
cout << itemTwo.getAskingPrice() <<
endl;
itemTwo.displayMotto();
return 0