Write a method showcontent in the myshop

Assignment Help JAVA Programming
Reference no: EM132528265

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 overriding, 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 (MyShopMain.java and MyShop.java) 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 MyShopMain.java

Part 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 MyShopMain.java 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", "Forbes", 8.99, "Forbes Media", 50, 202004);

The name of the magazine here is "Forbes", selling for $8.99. The publisher is "Forbes Media". It has 50 pages, and the current volume is 202004. You 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 MyShopMain.java. It also allows keyboard input to enter new contents. You are free to design the input menu. Note input validation is required.

Part 2: CREDIT Level --- You must ONLY attempt this level after you complete the PASS level

Class User

The User class has an ID, a username. NOTE, username can be changed by changeName() method.

Class Customer

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 MyShopMain.java.

Part 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 MyShopMain.java.

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.

Part 4: HD Level --- You must ONLY attempt this level after you complete the DI level

Premium customer

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.

b1.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 14.25. Otherwise 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);

Part 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.

Attachment:- java assignment.rar

Reference no: EM132528265

Questions Cloud

Firewall security strategies : You are provided a handout describing a scenario and the various firewall security strategies. Which strategies allow for the retention of data integrity?
What variable manufacturing overhead rate variance in march : What is the variable manufacturing overhead rate variance in March? is it favorable or unfavorable.Yama Induestries designs and manufactures bathtubs
Find the net present value for the investment is : The net present value for this investment is? The management of Tony Corporation is considering the purchase of a new machine costing $400,000.
Advancements blockchain on one industry : We have viewed how Blockchain has made a significant impact on businesses and industries.
Write a method showcontent in the myshop : Write a method showContent in the MyShop class to show a list of all available contents.Customer is a type of user. Each customer has a phone number
UG 024 Contemporary Issues in Accounting Assignment : UG 024 Contemporary Issues in Accounting Assignment Help and Solution - College of Banking and Financial Studies, Oman - Assessment Writing Service
What is the budgeted operating income for pillow cases : The variable costs are $2 per pillow case, and fixed costs are $8,000. What is the budgeted operating income for 7,000 pillow cases?
How much is the direct materials price variance : How much is the direct materials price variance? Yama Industries has collected the data for one of its products,Direct materials standard
What was your dollar return and percent return : If you owned 560 shares of Sprint, what was your dollar return and percent return?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Design and implement an applet that plays a simple game

Design and implement an Applet that plays a simple game to help teach a child to read. The game displays a picture on the left hand side of the Applet and a word on the right hand side. Below the pictures are two buttons for the child to click--on..

  Write a recursive public method

Write a recursive public method in our BST class that returns a reference to the information in the node containing the smallest value in the tree. The signature of the method is

  Write a java program which reads a text file

Write a Java program which reads a text file and writes the content into a new file. During the read-write process, convert all the upper case letters.

  Create an application that keeps tracks of the information

Create an application that keeps tracks of the information in such a simple social network. More specifically, your application will allow for user profiles to be added to, deleted from, or looked-up in the social network.

  Create a method named justsold that increments the hotdogs

Finally, add a static variable that tracks the total number of hotdogs sold by all hot dog stands and a static method that returns the value in this variable.

  Design an application for the sublime sandwich shop

Design an application for the Sublime Sandwich Shop. The user makes sandwich order choices from list boxes, and the application displays the price.

  Provide example in which sequential file is better choice

What are the advantages and disadvantages of sequential and random access files? Provide an example in which a sequential file is a better choice than a random

  Evaluate possible solutions-weigh the strengths

Evaluate possible solutions-weigh the strengths and limitations of each solution you discovered in Step 3 - Choose a solution-consider several factors such

  Accepts a binary number from the user

Write a Java test program that accepts a binary number from the user. You should store the binary number in a String. Your program should then use afor loop to sequence through every character in the String, counting the number of ones, zeros, and..

  Online banking management system - java project

Online Banking Management System Java Project - Identify Technical Advisor by name, contact information, position and responsibility

  Write a java sorting application with two classes

Problem. Write a Java Sorting Application with two classes, JavaSort and JavaSortTest. Your JavaSort Class, as a minimum must contain sorting methods for BubbleSort, InsertionSort, ShellSort, MergeSort, and QuickSort.

  Determine the best moves for an abbreviated game

determine the best moves for an abbreviated game of Connect4. The program will analyze the best starting position to make a move

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd