Question

In: Computer Science

a. Design a class named ItemForSale that holds data about items placed for sale on Carlos's...

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

Solutions

Expert Solution

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


Related Solutions

Write a class named RetailItem that holds data about an item in retail store.
Python 3Your program will have 2 classes:A) RetailItem ClassWrite a class named RetailItem that holds data about an item in retail store.Attributes: The class should store following data in attributes:>item_Name> PriceMethods:> RetailItem class’s __init__ method should accept an argument for each attribute.> RetailItem class should also have accessor and mutator methods for each attributeB) MainMenu ClassAttributes: The class should store following data in attributes:> List of RetailItem Objects: InventoryMethods:> createInventory(): method to create three RetailItem Objects store in list Inventory...
C++ Design a class named TermPaper that holds an author's name, the subject of the paper,...
C++ Design a class named TermPaper that holds an author's name, the subject of the paper, and an assigned letter grade. Include methods to set the values for each data field and display the values for each data field. Create the class diagram and write the pseudocode that defines the class. Pseudocode help please
In Java, design a class named MyInteger. The class contains: An int data field named value...
In Java, design a class named MyInteger. The class contains: An int data field named value that stores the int value represented by this object. A constructor that creates a MyInteger object for the specified int A get method that returns the int Methods isEven(), isOdd(), and isPrime() that return true if the value is even, odd, or prime, respectively. Static methods isEven(int), isOdd(int), and isPrime(int) that return true if the specified value is even, odd, or prime, respectively. Static...
Design a class named Account that contains: A private int data field named id for the...
Design a class named Account that contains: A private int data field named id for the account. A private double data field named balance for the account. A private double data field named annualInterestRate that stores the current interest rate. A no-arg constructor that creates a default account with id 0, balance 0, and annualInterestRate 0. The accessor and mutator methods for id, balance, and annualInterestRate. A method named getMonthlyInterestRate() that returns the monthly interest rate. A method named withdraw(amount)...
Design a class named Account that contains: A private String data field named accountNumber for the...
Design a class named Account that contains: A private String data field named accountNumber for the account (default AC000). A private double data field named balance for the account (default 0). A private double data field named annualIntRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor that creates a default account. A constructor...
Design a class named BankAccount that contains: A private int data field named id for the...
Design a class named BankAccount that contains: A private int data field named id for the account. A private double data field named balance for the account. A constructor that creates an account with the specified id and initial balance. A getBalance() method that shows the balance. A method named withdraw that withdraws a specified amount from the account. Create a subclass of the BankAccount class named ChequingAccount. An overdraftlimit to be 1000 for ChequingAccount . Test your ChequingAccount class...
7.3 (The Account class) Design a class named Account that contains: ■ A private int data...
7.3 (The Account class) Design a class named Account that contains: ■ A private int data field named id for the account. ■ A private float data field named balance for the account. ■ A private float data field named annualInterestRate that stores the current interest rate. ■ A constructor that creates an account with the specified id (default 0), initial balance (default 100), and annual interest rate (default 0). ■ The accessor and mutator methods for id, balance, and...
python3 Design a class named Histogram to display a histogram of data. The Histogram class contains...
python3 Design a class named Histogram to display a histogram of data. The Histogram class contains the following A number of instance variables/fields to store a histogram of data. You can design them by your own. A constructor that creates a histogram with the following a list of data. It may have more than 2 columns. x_width: the width of the 1st column in the horizontal histogram. The default value is 5. y_width: the width of the 2nd column in...
Java - Design a class named Account that contains: A private String data field named accountNumber...
Java - Design a class named Account that contains: A private String data field named accountNumber for the account (default AC000). A private double data field named balance for the account (default 0). A private double data field named annualIntRate that stores the current interest rate (default 0). Assume all accounts have the same interest rate. A private Date data field named dateCreated that stores the date when the account was created. A no-arg constructor that creates a default account....
In c++ Design a class named Account that contains: a.An int data field named id for...
In c++ Design a class named Account that contains: a.An int data field named id for the account. b.A double data field named balancefor the account. c.A double data field named annualInterestRate that stores the current interestrate. d.A no-arg constructor that creates a default account with id 0, balance 0, andannualInterestRate 0. e.The set and get functions for id,balance, and annualInterestRate. f.A functionearnedAmount()that calculates and returns the amount of dollars earned after one year. g.A function named printAccountInfo() that print...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT