Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

, 1. Overview The main objective of this assignment is to familiarize you with object oriented design and programming. Object oriented programming helps to solve complex problems by coming up with a...

1 answer below »
1. Overview
The main objective of this assignment is to familiarize you with object oriented design and programming. Object oriented programming helps to solve complex problems by coming up with a number of domain classes and associations. However identifying meaningful classes and interactions requires a fair amount of design experience. Such experience cannot be gained by classroom-based teaching alone but must be gained through project experience.
This assignment is designed to introduce different concepts such as inheritance, abstract classes, method overloading, method ove
iding, and polymorphism. Develop this assignment in an iterative fashion (as opposed to completing it in one sitting). You can and should get started now.
If there are questions, you must ask via the relevant Canvas discussion forums in a general manner (replicate your problem in a different context in isolation before posting).
4. Assessment details
MyShop is an online shop which allows users to download mobile applications (APPs) and publications like e-books and digital magazines. Applications and publication items in the MyShop are either free or can be bought for a price.
The program you create will allow the creation of a shop, filling it with products, creating users and simulating their interaction with the shop (requiring products, adding comments etc).
Your program should consist of multiple class files where you can demonstrate your knowledge of inheritance, polymorphism, method ove
iding, abstract classes, etc. You need to write classes, add methods and variables to complete the following tasks performed by the admin of the MyShop.
There are two sample/starter classes ( and provided.
The tasks in this assignments have been divided into different levels. You must complete all prior levels before moving on to a higher level.
You must specify the highest level that you have completed at the top of
Section 1: PASS Level
You may need to define methods wherever appropriate to support these classes.
Class MyShop

The MyShop class have two attributes: a list of Content and a list of User objects. Note that each content has a unique ID. An
 instance of the MyShop class named shop is created in the main method of MyShopMain. The interaction with this shop is simulated within the main method (see the class).
Write a method showContent in the MyShop class to show a list of all available contents.
Class Content

Mobile apps and publication items are Content of the MyShop. Each Content (either application or publication) is associated with the following information: an ID, name, number of downloads, price. Class Content cannot and should not be instantiated.
Class Application

Application objects contain information such as ID, name, number of downloads and price. In addition, an Application object has an OS (operating system) type that presents the minimum operating system requirement. An Application object can be initialized as
Application game1 = new Application("g1", "Fruit Ninja", 4.7, "androidV4");
In the above example the price of the app is $4.7 dollar, “androidV4” is the OS requirement.
Initially the number of downloads is zero.
If no price is provided, the application is then free.
Application app1 = new Application("app1", "Calendar", "androidV3");
Class Publication
Another type of Content is Publication. In addition to the data that the Content class has, a Publication object also has: publisher and number of pages.
Class Book

Book is one type of Publication. It has additional data: publisher, number of pages and author name. Notes, it is possible that one book have multiple authors.
A Book object can be initialized as
String[] authors = {"L. Tolstoy"};

Book b1 = new Book ("b1", "War and Peace", 12.55, "The Russian Messenger", 1225, authors);
“War and Peace” is the name of the book; 12.55 is the price; “The Russian Messenger” is the publisher. The book has 1225 pages and is of course authored by “L. Tolstoy”.
Class Magazine

Another type of Publication is Magazine, which has an additional data: volume. A magazine does not contain any author’s name. A Magazine object can be initialized as
Magazine m1 = new Magazine("m1", "Fo
es", 8.99, "Fo
es Media", 50, 202004);
The name of the magazine here is “Fo
es”, selling for $8.99. The publisher is “Fo
es Media”. It has 50 pages, and the cu
ent volume is XXXXXXXXXXYou can assume the volume is always an integer showing the year and the month.
At this level, your program should be able to show all the contents in the shop including all the applications, books and magazines been added to the shop.
New contents can be directly added in It also allows keyboard input to enter new contents. You are free to design the input menu. Note input validation is required.
Section 2: CREDIT Level --- You must ONLY attempt this level after you complete the PASS level
Class Use
The User class has an ID, a username. NOTE, username can be changed by changeName() method.
Class Custome
Customer is a type of user. Each customer has a phone number and available fund in the account. By default, a new user will start with 50 in balance. A Customer can be initialized as:
Customer c1 = new Customer("u1", "coolguy", "0412000", 200);
Mary has a balance of 50
User u2 = new User("u2", "neversaynever", "0433191");
c2 has a balance of 50
Customer c2 = new Customer("u2", "neversaynever", "0433191");
Class Admin
Admin is a special type of user. Each admin has a password and a level. The level is an integer indicating the level of his/her admin privilege.
Admin a2 = new Admin("a2", "Adele", "kitty123", 3);
At this level, your program should be able to show all the users in the shop including all the customers and admins. New users can be added in
Section 3: DI Level --- You must ONLY attempt this level after you complete the CREDIT level
A this level, each content item, either application or publication, can be reviewed by customers.
Review is a collection of Comment object. One content may have multiple comments as its review.
Class Comment

A Comment class keeps the following data: a Customer, which is customer who wrote the comment and a string for the comment. A Comment object can be initialized as
Comment comment1 = new Comment(c1, "This is a fantastic game!");
A Comment class may be initialised with an integer between 0 to 5, which is the rating from the customer.
Comment comment2 = new Comment(c2, 5);
A mix is also possible, e.g.
Comment comment3 = new Comment(c3, 3, "This is an average game!"); Comment comment4 = new Comment(c4, "I quite like this game!", 4);
Your program should be able to show all the comments for one content. It can also show every comment in the shop as well (all comments for all contents). New comments can be added in
In addition, customers can buy content through method download, where the parameter is a Content type of object. When a user buys any content, the price of that content needs to be deducted from the balance of that user. Do necessary checks before the deduction. The number of downloads of the content should be updated as well after the purchase.
A user may buy multiple content. Write a method showDownloads in the User class to show the list of names of all the contents that the user has bought.
Your program can show the number of downloads for one content. It can also show the number of downloads for all contents in the shop as well. You are free to design how that can be shown.
Section 4: HD Level --- You must ONLY attempt this level after you complete the DI level
Premium custome
With the method becomePremium(), a customer can be upgraded to a Premium customer for a cost of $100. A premium customer gets 20% discount on each purchase of contents after becoming premium. Be careful, this upgrade is NOT free.
You can assume this upgrade cannot be undone, meaning there is no downgrade and refund.
Bulk download
At this level, customers can download in bulk, e.g. download(list), there are multiple items in list.
If the bulk download is not successful, e.g. short of fund, then nothing will be added.
Admin functions
An admin can login in and reset the price for and item, e.g.
1.setPrice(a2.login(), 14.25);
The setPrice method takes the return value of method login() as one of its input parameter. If login is successful, then the price of b1 will be set to XXXXXXXXXXOtherwise unchanged.
The login() method simply asks for keyboard input and checks whether the input is the same as the password stored in the admin object. That is a2 in the above example.
If the admin’s level is above 5, then the admin can adjust prices in bulk for all contents in the shop, e.g. a bulk price reduction of 10% as shown below. This task would not be successful if the admin’s privilege level is 5 or below.
shop.setPrice(a1.login(), a1.getLevel(), -0.10);
Section 5: Input and output
Your program should hard code a list of objects including content objects, user objects and comment objects etc. for testing purpose. See the skeleton sample code. (During marking, we may replace these objects with our own to test your program).
You program should have a simple menu to allow aforementioned tasks up to the level you are attempting, for example: showing all contents; downloading one content for one user; showing all downloaded content of a user; upgrading a member to premium account; showing all comments of all contents etc.
Input validation and e
or handling should be implemented.
5. Referencing guidelines
What: This is an individual assignment and all submitted contents must be your own. If you have used sources of information other than the contents directly under Canvas→Modules, you must give acknowledge the sources and give references using IEEE referencing style.
Where: Add a code comment near the work to be referenced and include the reference in the IEEE style.
How: To generate a valid IEEE style reference, please use the citethisforme tool if unfamiliar with this style. Add the detailed reference before any relevant code (within code comments).
1. Your final code submission should be clean, neat, and well-formatted (e.g., consistent indentations) and abide by the formatting guidelines.
2. Identifiers should be named properly and camel case e.g. UsedCar (class) and carPrice (variable). [Google “camel case”]
3. You must include adequate meaningful code-level comments in your program.
4. For each input from the user, display appropriate prompt message.
5. For each invalid input from the user, display appropriate e
or message.
Answered Same Day May 27, 2021


Arun Shankar answered on May 28 2021
138 Votes


public synchronized class Admin extends User {
String password;
int level;
void Admin(String, String, String, int);
public String toString();
public synchronized class Application extends Content {
String os;
void Application(String, String, double, String);
void Application(String, String, String);
public String toString();
public synchronized class Book extends Publication {
String[] authors;
void Book(String, String, double, String, int, String[]);
void Book(String, String, String, int, String[]);
public String toString();
public abstract synchronized class Content {
String id;
String name;
int num_of_downloads;
double price;
void Content(String, String, double);
public String toString();
public synchronized class Customer extends User {
String phone;
int fund;
void Customer(String, String, String, int);
void Customer(String, String, String);
public String toString();
public synchronized class Magazine extends Publication {
int volume;
void Magazine(String, String, double, String, int, int);
void Magazine(String, String, String, int, int);
public String toString();
public synchronized class MyShop {
private java.util.A
ayList contents;
private java.util.A
ayList users;
public void MyShop();
public void addContent(Content);
public void showContent();
public void addUser(User);
public void showUser();
public synchronized class MyShopMain {
public void MyShopMain();
private static int get_integer_input(int, int);
private static double get_double_input(double, double);
public static void main(String[]);
public synchronized class Publication extends Content {
String publisher;
int num_of_pages;
void Publication(String, String, double, String, int);
void Publication(String, String, String, int);
public String toString();
public synchronized class User {
String id;
String username;
void User(String, String);
public void changeName(String);
public String...

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here