Question

Design a set of classes that work together to simulate the Stock Transaction System. You should...

Design a set of classes that work together to simulate the Stock Transaction System. You should design the following classes:

1. the StockMarket class. This class simulates the stock market such as Nasdaq, NYSD, or other stock market. The class's responsibility are as follows:

   -To know the stock market abbreviation, full name, location, an arraylist of stocks for this market

2. the Company class: this class simulates a company that has stock released on a stock market. The class's responsibilities are as follows:

   -To know the name, location, the stock (an object from the Stock class)and total number of shares released of the company, as well as the arraylist of customers holding the stock.

3. the Stock class: this class simulates a stock. The class's responsibilities are as follows:

   - To know the symbol, price of the stock

4. The Customer class: This class should simulate a customer that performs a stock transaction. The class's responsibility are as follows:

   -To know the customer id, customer name, the broker for the customer (which is an object from the Broker class), the available cash balance. It also has an arraylist of stocks holding by this customer and the number of shares for that stock.

5. The Broker class: This class should simulate a broker. The class's responsibility are as follows:

   -To know the broker license number, broker name, the total commissions (2% of the transaction amount) for the broker. It also has an arraylist of customers served by this broker and an arraylist of stock transactions (which are objects from Transaction class) performed by this broker.

6. The Transaction class: This class should simulate a stock transaction. The class's responsibility are as follows:

   -To know the transaction id, transaction type (buy/sell), transaction stock (an object from the Stock class), transaction price, broker for the transaction (object from the Broker class), customer for the transaction (object from the Customer class).

  

For each class, define proper data fields, getters and setters, as well as other required methods.

Write a program that demonstrate how these classes collaborate together to simulate a stock transaction system.

For example: You may need more than the following two operations.

1. when a company IPO at a stock market, a corresponding Stock object should be created for that company, and a stock should also be added to the arraylist of stocks at that stock market

2. when a customer initializes a stock purchasing through a broker, an object of the Transaction class should be created. For the broker: the total commission, the arraylist of the broker's customers, the arraylist of transactions performed by the broker should be updated. For the customer, the cash balance, the stock holding positions should be updated.

Hints:

1. The data fields/properties/attributes of a class are the things a class should know

2. Any behavior or action of a class should be defined as methods of that class

3. Data security of aggregation is done through copy constructor

Requirements:

well-documented java program

0 0
Add a comment Improve this question Transcribed image text
Answer #1

class StockTransactionSystem

{

public class StockMarket

{

string location;

string fullName;

string abbreviation:

string[] stocks;

}

public class Company

{

string name;

string location;

int noOfShares;

string[] customersOfStock;

Stock stock = new Stock();
}

public class Stock

{

string symbolofStock;

float priceofStock;

}

public class Customer

{

string name;

int id;

string broker;

float cashBalance;

Broker broker = new Broker();

}

getTransactionAmt(int id,int TrasactionId)

{

return Amount;
}

getTransactions(int id,int TransactionId)

{

return Transactions;

}

public class Broker

{

string LicenceNo;

string Name;

Transaction transaction = new Transaction();

}

public class Transaction

{

int id;

string type;

float price;

Stock stock= new Stock();

Broker broker = new Broker();

Customer customer= new Customer();

}

getStocksOfCustomer(int id)

{

return stocksOfCustomer;
}

getcustomersOfBroker(string name)

{

return customers;
}

noOfShares(int id,string symbol)

{

return noOfSharesForStock;

}

getStockSymbol()

{

return symbolofStock;

}

getStockPrice(symbolOfStock:string)

{

return priceOfStock;

}

getNoOfShares(string name)

{

return noOfShares;

}

get customersOfStock(string company,string stockSymbol)

{

return customersOfStock;
}

getStockMarketLocation()

{

return location;
}

getFullNameOfStockMarket(abbreviation:string)

{

return fullName;
}

get stocks()

{

return stocks;
}

public static void main(string args[])

{

initializeStockPurchase();

initializeIPO();
}

initializeIPO()

{

Stock s= new Stock();

s.setStocksofMarket();


}


}

Add a comment
Know the answer?
Add Answer to:
Design a set of classes that work together to simulate the Stock Transaction System. You should...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • need code for this in java Design a set of classes that work together to simulate the Stock Transaction System. You should design the following classes: 1. the StockMarket class. This class si...

    need code for this in java Design a set of classes that work together to simulate the Stock Transaction System. You should design the following classes: 1. the StockMarket class. This class simulates the stock market such as Nasdaq, NYSD, or other stock market. The class's responsibility are as follows: -To know the stock market abbreviation, full name, location, an arraylist of stocks for this market 2. the Company class: this class simulates a company that has stock released on...

  • Please help me with this exercises in JAVA, Thank you ===================== Parking Ticket Simulator Assignment =====================...

    Please help me with this exercises in JAVA, Thank you ===================== Parking Ticket Simulator Assignment ===================== For this assignment you will create a set of classes from scratch (no provided class files for this assignment) that work together to simulate a police officer issuing a parking ticket. You should design the following classes / functionality within them: ===================== ParkedCar.java: ===================== This class should simulate a parked car. The class's responsibilities are as follows: - To store the car's make, model,...

  • using java: For this exercise, you will design a set of classes that work together to simulate a parking officer checkin...

    using java: For this exercise, you will design a set of classes that work together to simulate a parking officer checking a parked car issuing a parking ticket if there is a parking violation. Here are the classes that need to collaborate: • The ParkedCar class: This class should simulate a parked car. The car has a make, model, color, license number. •The ParkingMeter class: This class should simulate a parking meter. The class has three parameters: − A 5-digit...

  • For this assignment, you will design tow classes that work together to simulate a car's fuel...

    For this assignment, you will design tow classes that work together to simulate a car's fuel gauge and odometer. The classes you will design are the following: 1. The FuelGauge Class: This class will simulate a fuel gauge. Its responsibilities are: To know the car's current amount of fuel, in gallons. To report the car's current amount of fuel, in gallons. To be able to increment the amount of fuel by one gallon. This simulates putting fuel in the car....

  • this is java m. please use netbeans if you can. 7. Person and Customer Classes Design...

    this is java m. please use netbeans if you can. 7. Person and Customer Classes Design a class named Person with fields for holding a person's name, address, and telephone number. Write one or more constructors and the appropriate mutator and accessor methods for the class's fields. Next, design a class named Customer, which extends the Person class. The Customer class should have a field for a customer number and a boolean field indicating whether the cus- tomer wishes to...

  • I need help with this java project and please follow the instruction below. thank Class Project...

    I need help with this java project and please follow the instruction below. thank Class Project - Parking Ticket simulator Design a set of classes that work together to simulate a police officer issuing a parking ticket. Design the following classes: •           The ParkedCar Class: This class should simulate a parked car. The class’s responsibilities are as follows: – To know the car’s make, model, color, license number, and the number of minutes that the car has been parked. •          ...

  • Assignment 4 Due Mar 22 by 11:59pmPoints 100 Submitting a file upload A4 OOP 2 "Car...

    Assignment 4 Due Mar 22 by 11:59pmPoints 100 Submitting a file upload A4 OOP 2 "Car Instrument Simulator" Access A4 from pdf assignment file & Turn in the following files: a4main.java FuelGauge.java Odometer.java program compile and run screenshots design document (including UML) A4 10. Car Instrument Simulator For this assignment, you will design a set of classes that work together to simulate a car's fuel gauge and odometer. The classes you will design are the following: · The Pue|Gauge Class:...

  • Design and implement a set of classes that define the employees of a hospital. Start by...

    Design and implement a set of classes that define the employees of a hospital. Start by creating a HospitalEmployee super class, from which three other classes will inherit. The HospitalEmployee class will have the following components: • name - a private String instance variable containing the employee's name (taken in the object constructor) • field - a private String instance variable containing the employee's field (e.g. cardiology, oncology) (taken in the object constructor) • onCall - a private boolean instance...

  • Assignment 6 Due: Apr 12, 2019 at 11:59 PM A6 OOP 3 "PreferredCustomer Class" (need to...

    Assignment 6 Due: Apr 12, 2019 at 11:59 PM A6 OOP 3 "PreferredCustomer Class" (need to create Person, Customer classes described in the previous problem) Access A6 from pdf assignment file. Turn in the following files: a6main.java Customer.java Person.java PreferredCustomer.java program compile and run screenshots design document (including UML) A6 7. Person and Customer Classes esign a class named Person with fields for holding a person's name, address, and telephone number. Write one or more constructors and the appropriate mutator...

  • Java 1. Develop a program to emulate a purchase transaction at a retail store. This program...

    Java 1. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual line item of merchandise that a customer is purchasing. The Transaction class will combine several LineItem objects and calculate an overall total price for the line item within the transaction. There will also be two test classes, one for the LineItem class and one for the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT