Demonstrate your knowledge of inheritance

Assignment Help Programming Languages
Reference no: EM132310257

Assignment

Objective

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 overriding, and polymorphism.

General Requirements

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 error message.

6. IMPORTANT: your code should be able to compile and run under command-line.

Assignment overview

A PlayStore is a standalone digital marketplace that allows users to browse and download mobile applications (APPs). The PlayStore also serves as a digital store offering publications like e-books and digital magazines. Applications and publication items in the PlayStore are either free or can be bought for a price.

The program you create will allow the creation of a store, filling it with products, creating users and simulating their interaction with the store (purchasing products, adding comments etc).

Assessment tasks

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

There are two sample/starter classes (PlayStoreMain.java and PlayStore.java) provided.

Section 1: The classes and their attributes

Group A - content classes

You may need to define methods wherever appropriate to support these classes.

Class Content
Mobile apps and publication items are Content of the PlayStore. Each Content (either application or publication) is associated with the following information: an ID, name, number of downloads, price, and reviews. Reviews is a collection of Comment objects (see Group B for details). Class Content cannot and should not be instantiated.

Class Application
Application is a type of Content. In addition to the data that a content class have, an Application object has an OS type that presents the minimum operating system requirement. An Application object can be initialized as
Application g1 = new Application("g1", "Pokemon", 5.3, "androidV4");

In the above example 5.3 is the price of the app in dollars, "androidV4" is the OS requirement. Initially the number of downloads is zero, and the reviews are empty.
Application app1 = new Application("app1", "Calendar", "androidV3");

If no price is provided, the application is then free.

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
One type of Publication is Book, which has an additional data: the 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, 201904);

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 201904. You can assume the volume is always an integer showing the year and the month.

Group B - associated classes

Again, you may need to define methods wherever appropriate to support these classes.

Class Comment
A Comment class keeps the following data: a User, which is the user who wrote the comment and a string for the comment. A Comment object can be initialized as

Comment comment1 = new Comment(u3, "This is a fantastic book!");

Class User

The User class has an ID, a name, a phone number and available fund in the account. By default, a new user will start with 500 in balance. A User can be initialized as:

User u1 = new User("u1", "John Doe", "0412000", 200);
User u2 = new User("u2", "Mary Poppins", "0433191"); // Mary has a balance of 500

Class PlayStore
The PlayStore class have two attributes: a list of Content and a list of User objects. Note that each content can be uniquely identified by content ID. An instance of the PlayStore class named store is created in the main method of PlayStoreMain. The interaction with this store is simulated within the main method (see the PlayStoreMain.java class).

Section 2: Functionalities of the classes

User functionalities

1. Method becomePremium. A user can become a Premium user for a cost of $100. A premium user gets 20% discount on each purchase of the contents after becoming premium.

2. Method buyContent, 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. You need to consider whether the user is a premium user or not in this step. The number of downloads of the content should increase after the purchase.

a. Exceptions must be thrown when trying to buy a content with an insufficient balance. The exception thrown must indicate the cause of error, show an appropriate error message, allowing the caller to respond appropriately and recover if possible. Note that when you add exceptions the method calls will need to be surrounded by try/catch blocks.

b. A user may buy multiple content. Write a method showContentBought in the User class to show the list of names of all the contents that the user has bought. You may add additional attributes in the User class if necessary.

Content and Comment functionalities

3. Write a method for the Content class, where a comment/review (which is a Comment type of object) from users can be added to a Content object.

4. Write a method showComments in the Content class to show all the comments of a Content
object (e.g. a particular game or book).

PlayStore and Admin functionalities

5. Write a method showContent of the PlayStore class to show a list of all available contents. Also write a method for each type of contents to show the list of contents of that type (e.g., show all applications, show all books, show all magazines).

Do you need to write a method for each type? Is that possible to use one method for this task? (Hint: You may find Java getClass() method in java.lang.Object useful).

Use of Java Collections (Not Required, 2 bonus marks)

6. You are encouraged to use collections such as ArrayList and HashMap. ArrayList implements an array which can grow indefinitely. HashMap allows an association to be created between keys and objects. Using such classes also reduces the amount of code required as they provide methods for retrieving required objects easily.

ArrayList<Comment> comments = new ArrayList<Comment>(); comments.add(someComment);

To extract the 4th element:
Comment c4 = comments.get(3); // index starts at 0

You can use HashMap for storing objects, which have unique primary keys. For example,
HashMap<String, Content> contents = new HashMap<String, Content>();

To add a content we use:
contents.put(new Game(...));

To extract the content, use:
content content1 = contents.get("G101"); // return null if no such content is found

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 an admin to perform aforementioned tasks such as:
* upgrading a member to premium account;
* purchasing one item for one user;
* listing all available contents;
* showing all purchased items of a user;
* showing all comments of a content;

Input validation and error handling should be implemented. Input and output should be inside of the class PlayStoreMain.

Attachment:- Programming Fundamentals.rar

Verified Expert

This project is a java project to create a playstore application. The project uses the concepts of classes, inheritance, polymorphism to implement the functionality of the playstore where the admin can add the contents of different types in the store, and user can buy the products and add comments about the products.

Reference no: EM132310257

Questions Cloud

Office of ellsberg psychiatrist to fade from view : At the time the decision was made, what factors caused the morality of the decision to break into the office of Ellsberg's psychiatrist to fade from view?
Identify parameters of your inquiry using current literature : Establish what is known and unknown, using current literature from the last 5 years, relevant to the variables you have identified.
Culture behaviors that marketers try to exploit today : Why is study and understanding of cultural variances so vitally important to marketers? What are some culture behaviors that marketers try to exploit today?
Which habits of systems thinker help you understand issue : Which habits of the systems thinker help you understand this issue more deeply, and how? (Choose at least 4 habits). Chose at least one of these tools/lenses.
Demonstrate your knowledge of inheritance : COSC2531 - Programming Fundamentals - RMIT University - demonstrate your knowledge of inheritance, polymorphism, method overriding, abstract classes, etc
Explain the pharmacological aspects of the drug : In your Rapid Review, analyze and explain the pharmacological aspects of the drug as they relate to the following: neurotransmitters affected, receptors, route.
Which stage is associated with learning and memory : Review the material on the 5 stages of sleep cycles. After reviewing the material, respond to the following questions: What are the 5 stages?
What conflicting values are at stake in the case : MGT501 Contemporary Management-Charles Sturt University Australia-Evaluate the usefulness of the management and organisational theories.
Egil krogh eventual journey to prison : How was ethical fading a part of Egil Krogh's eventual journey to prison? Explain.

Reviews

len2310257

5/22/2019 10:07:23 PM

1. Code quality and style 2. Modularity / Use of classes, inheritance, polymorphism, methods & arguments 3. Comments / Reflection / Lessons learnt 3 marks Can compile and run under command line 1 mark Can perform required tasks during demo 2 marks Can make required modifications during demo 2 marks

len2310257

5/22/2019 10:07:12 PM

Functionality 3 0.5 mark Functionality 4 0.5 mark Functionality 5 1 mark Functionality 6 2 bonus marks Input and Output 3 marks

len2310257

5/22/2019 10:07:05 PM

Assessment Task Marks Group A 2 marks Group B 2 marks Functionality 1 1 mark Functionality 2 2 marks

len2310257

5/22/2019 10:06:51 PM

General Requirements 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 error message. 6. IMPORTANT: your code should be able to compile and run under command-line.

len2310257

5/22/2019 10:06:42 PM

2. (Optional) If you are unable to complete the code, please also submit a word or pdf document file with the brief description of problems encountered and lessons learnt. If you have not received full marks during the demonstration and then made any change in your code afterwards, submit a word or pdf document file with the brief description of changes as well.

len2310257

5/22/2019 10:06:34 PM

The final submission is due on week 12. Your final submission through Canvas should be a zip file that includes the following files – 1. The java files of your assignment. Do not submit the .class file.

len2310257

5/22/2019 10:06:22 PM

This is an individual assignment worth 20% of your final grade. The grading is based on both demonstration and final code submission. You must demonstrate your assignment in your timetabled practical class prior to your final submission.

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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