COSC2531 Programming Fundamentals Assignment - RMIT University, Australia
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.
EXPERTSMINDS.COM GIVES ACCOUNTABILITY OF YOUR TIME AND MONEY - AVAIL TOP RESULTS ORIGINATED COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT HELP SERVICES AT BEST RATES!
Group A - content classes
Class Content - Mobile apps and publication items are Content of the PlayStore. Each Content 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.
import java.util.ArrayList;
public class Content {
// Content class store the details of content in play store
private final String ID;
private final String name;
private int numOfDwds;
private final double price;
private final ArrayList<Comment> reviews;
public Content(String ID, String name, int numOfDwds, double price, ArrayList<Comment> reviews){
// constructor of the class
this.ID=ID;
this.name=name;
this.numOfDwds=numOfDwds;
this.price=price;
this.reviews=reviews;
}
public String getID(){
// accessor for ID
return ID;
}
public String getName(){
// accessor for name
return name;
}
public double getPrice(){
// accessor for price
return price;
}
public void addReview(Comment review) {
// addReview() is used add review to content
reviews.add(review);
}
public void download() {
// download() causes the content downloads to be incremented by 1
numOfDwds++;
}
public void showReviews(){
// showReviews() is used to display list of all review about the content
System.out.println("List of all reviews about the content "+name+"("+ID+")"+":");
// showReviews() displays the list of comments
if(reviews.size()>0) {
// loop for each comment in reeviews
for(Comment comment: reviews){
// display comment
System.out.println(comment);
}
}
else {
System.out.println("No Comments");
}
}
@Override
public String toString(){
return "ID:"+ID + " Name:" + name + " Price:tiny_mce_markerquot; + price + " Number of Downloads:"+ numOfDwds;
}
}
ENROL WITH COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT HELP AND HOMEWORK WRITING SERVICES OF EXPERTSMINDS.COM AND GET BETTER RESULTS IN COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENTS!
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.
import java.util.ArrayList;
public class Application extends Content {
// Application class stores details of application content
private final String osType;
public Application(String ID, String name, double price, String osType){
// parameterized constructor of class with 4 arguments
super(ID, name, 0, price, new ArrayList<Comment>());
this.osType = osType;
}
public Application(String ID, String name, String osType){
// parameterized constructor of class with 3 arguments
super(ID, name, 0, 0, new ArrayList<Comment>());
this.osType = osType;
}
@Override
public String toString(){
return "Application(" + super.toString()+" OS Type:" + osType + ")";
}
}
24/7 AVAILABILITY OF TRUSTED COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT WRITERS! ORDER ASSIGNMENTS FOR BETTER RESULTS!
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.
import java.util.ArrayList;
class Publication extends Content{
// Publication class stores publication details
private final String publisher;
private final int numOfPages;
public Publication(String ID, String name, double price, String publisher, int numOfPages) {
// parameterized constructor of class
super(ID, name, 0, price, new ArrayList<Comment>());
this.publisher=publisher;
this.numOfPages=numOfPages;
}
@Override
public String toString(){
return super.toString() + " Publisher:"+publisher+" Number of Pages:"+numOfPages;
}
}
GET ASSURED A++ GRADE IN EACH COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT ORDER - ORDER FOR ORIGINALLY WRITTEN SOLUTIONS!
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.
public class Book extends Publication{
// Book class stores book details which is publication
private final String[] authors;
public Book (String ID, String name, double price, String publisher, int numOfPages, String[] authors){
// parameterized constructor of class
super(ID, name, price, publisher, numOfPages);
this.authors=authors;
}
@Override
public String toString(){
String authorNames="";
for(String name:authors){
authorNames+=name+" ";
}
return "Book("+ super.toString() + " Authors:" + authorNames + ")";
}
}
NO PLAGIARISM POLICY - ORDER NEW COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT & GET WELL WRITTEN SOLUTIONS DOCUMENTS WITH FREE TURNTIN REPORT!
Class Magazine - Another type of Publication is Magazine, which has an additional data: volume. A magazine does not contain any author's name.
public class Magazine extends Publication{
// Magazine class stores details about magazine which is a publication
private final int volume;
public Magazine (String ID, String name, double price, String publisher, int numOfPages, int volume){
// parameterized constructor of class
super(ID, name, price, publisher, numOfPages);
this.volume=volume;
}
@Override
public String toString(){
return "Magazine("+ super.toString() + " Volume:" + volume + ")";
}
}
ENDLESS SUPPORT IN COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENTS WRITING SERVICES - YOU GET REVISED OR MODIFIED WORK TILL YOU ARE SATISFIED WITH OUR COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT HELP SERVICES!
Group B - associated 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.
public class Comment {
// Comment class stores comment details
private final User user;
private final String comment;
public Comment(User user, String comment){
// parameterized constructor of class
this.user=user;
this.comment=comment;
}
public String toString(){
// returns the details of comment in the form of String
return user.getName()+"("+user.getID()+") - "+comment;
}
}
HELPING STUDENTS TO WRITE QUALITY COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT AT LOW COST!
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.
import java.util.ArrayList;
public class User {
// User class stores user details
private final String ID;
private final String name;
private final String phoneNumber;
private double availableFunds;
private boolean isPremium;
private final ArrayList<Content> contentBought;
public User(String ID, String name, String phoneNumber, double availableFunds){
// parameterized constructor1 of class with available funds
this.ID=ID;
this.name=name;
this.phoneNumber=phoneNumber;
this.availableFunds=availableFunds;
this.isPremium=false;
this.contentBought=new ArrayList<>();
}
public User(String ID, String name, String phoneNumber){
// parameterized constructor1 of class without available funds
this.ID=ID;
this.name=name;
this.phoneNumber=phoneNumber;
this.availableFunds=500;
this.isPremium=false;
this.contentBought=new ArrayList<>();
}
public String getID(){
// accessor for ID
return ID;
}
public String getName(){
// accessor for name
return name;
}
public void becomePremium() {
// becomePremium() makes user as premium if they have funds
if(!isPremium){
// check for funds availability
if(availableFunds<100){
System.out.println(name+"("+ID+") has less than $100 so user cannot afford for premium membership");
return;
}
// Take $100 for premium membership
availableFunds -= 100;
// update user as premium user
isPremium=true;
// display success message
System.out.println(name+"("+ID+") is now premium member");
}
else{
System.out.println(name+"("+ID+") is already a premium member");
}
}
public void buyContent(Content content) {
// buyContent() buys content for the user
try{
// calculate the price of the content based on user typpe
double contentCost=0.0;
if(isPremium){
contentCost=content.getPrice()*0.80;
}
else{
contentCost=content.getPrice();
}
// check if user can buy or not
if(availableFunds<contentCost){
throw new Exception(name+"("+ID+") has funds less than price of "+ content.getName() +"("+content.getID()+")");
}
// add content to user bought list
contentBought.add(content);
// download the content
content.download();
// decrement the available funds by cost of content
availableFunds -= contentCost;
// display success message
System.out.println(name+"("+ID+") has bought "+content.toString());
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
}
public void showContentBought() {
// showContentBought() displays list of contents bought by user
System.out.println(name+"("+ID+") has bought the following contents: ");
// check if any content is bought
if(contentBought.size()>0) {
for(Content content:contentBought){
// display the content name
System.out.println(content.toString());
}
}
else {
System.out.println("No Contents");
}
}
}
DO WANT TO HIRE TUTOR FOR ORIGINAL COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT SOLUTION? AVAIL QUALITY XXXX ASSIGNMENT WRITING SERVICE AT BEST RATES!
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).
//You may need the following packages
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class PlayStore {
// Play Store class stores the available contents for downloads
private Map<String, ArrayList<Content>> contents;
private Map<String, User> users;
public PlayStore() {
// constructor of the class
contents=new HashMap<String, ArrayList<Content>>();
users=new HashMap<String, User>();
}
public void addContent(Content content) {
// addContent() adds content into content list
// add the content into your content list based on the content type
String contentType=content.getClass().getSimpleName();
if(!contents.containsKey(contentType)){
contents.put(contentType, new ArrayList<>());
}
contents.get(contentType).add(content);
}
public void addUser(User user) {
// addUser() adds user to user list
users.put(user.getID(), user);
}
public void showContent() {
// showContent() displays list of contents by its type
for(String contentType: contents.keySet()){
System.out.println("List of "+contentType+" are given below: ");
for(Content content : contents.get(contentType)){
System.out.println(content);
}
System.out.println("");
}
}
public User getUser(String userID) {
// getUser() returns user with userID
if(users.containsKey(userID)){
return users.get(userID);
}
return null;
}
public Content getContent(String contentID) {
// getContent() returns content with specific contentID
for(String contentType: contents.keySet()){
for(Content content : contents.get(contentType)){
if(content.getID().equals(contentID)){
return content;
}
}
}
return null;
}
}
GETTING STUCK WITH SIMILAR COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT? ENROL WITH EXPERTSMINDS'S COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT HELP SERVICES AND GET DISTRESSED WITH YOUR ASSIGNMENT WORRIES!
PlayStoreMain
import java.util.Scanner;
public class PlayStoreMain {
public static void main(String[] args) {
PlayStore store = new PlayStore();
// new publications
String[] authors1 = {"L. Tolstoy"};
Book b1 = new Book ("b1", "War and Peace", 12.55, "The Russian Messenger", 1225, authors1);
String[] authors2 = {"F. Scott Fitzgerald"};
Book b2 = new Book ("b2", "The great gatsby", 10, "Charles Scribner's Sons", 180, authors2);
String[] authors3 = {"Thomas H. Cormen", "Charles E. Leiserson", "Ronald L. Rivest", "Clifford Stein"};
Book b3 = new Book ("b3", "Introduction to algorithms", 100, "MIT Press", 1312, authors3);
Magazine m1 = new Magazine("m1", "Forbes", 8.99, "Forbes Media", 50, 201904);
store.addContent(b1);
store.addContent(b2);
store.addContent(b3);
store.addContent(m1);
Application g1 = new Application("g1", "Pokemon", 5.3, "androidV4");
Application g2 = new Application("g2", "Pokemon", 5, "iOSV10");
//a free app
Application app1 = new Application("app1", "Calendar", "androidV3");
store.addContent(g1);
store.addContent(g2);
store.addContent(app1);
// Adding new users
User u1 = new User("u1", "John Doe", "0412000", 200);
User u2 = new User("u2", "Mary Poppins", "0433191");
User u3 = new User("u3", "Dave Smith", "0413456", 1000);
User u4 = new User("u4", "Jackie Chan", "0417654");
store.addUser(u1);
store.addUser(u2);
store.addUser(u3);
store.addUser(u4);
Comment comment1 = new Comment(u1, "This is a fantastic game!");
g1.addReview(comment1);
Comment comment2 = new Comment(u2, "I never liked this game!");
g1.addReview(comment2);
g1.addReview(new Comment(u3, "The game crashes frequently"));
b1.addReview(new Comment(u2, "I love Tolstoy!"));
// Simulating transactions, showing content, comments etc etc.
// They can be driven by menu input as well.
u1.buyContent(b1);
u1.buyContent(b3);
u1.buyContent(m1);
u4.buyContent(g1);
u4.becomePremium();
u4.buyContent(m1);
u2.becomePremium();
u2.buyContent(b1);
u2.buyContent(g1);
store.showContent();
g1.showReviews();
// to do: call a method to show all content items of a particular type, e.g. book, magazine, application.
// other necessary code to test the required functionalities.
Scanner scanner=new Scanner(System.in);
boolean loop=true;
// loop until user wishes to exit
while(loop) {
// display menu
System.out.println("\nMenu");
System.out.println("****");
System.out.println("1) Upgrading a member to premium account");
System.out.println("2) Purchasing one item for one user");
System.out.println("3) Listing all available contents");
System.out.println("4) Showing all purchased items of a user");
System.out.println("5) Showing all comments of a content");
System.out.println("6) Exit");
// get user option
System.out.print("Enter your option: ");
String option=scanner.nextLine();
if(option.equals("1")) {
// get user id
System.out.print("Enter user ID: ");
String userID=scanner.nextLine();
// determine user object from ID
User user=store.getUser(userID);
// check if user exist and make the user as premium
if(user!=null) {
user.becomePremium();
}
else{
System.out.println("User does not exist");
}
}
else if(option.equals("2")) {
// get user id
System.out.print("Enter user ID: ");
String userID=scanner.nextLine();
// determine user object from ID
User user=store.getUser(userID);
// check if user exist and make a purchase
if(user!=null) {
// get content id
System.out.print("Enter content ID: ");
String contentID=scanner.nextLine();
// determine content object from ID
Content content=store.getContent(contentID);
// check if content exist and buy content
if(content!=null) {
user.buyContent(content);
}
else {
System.out.println("Content does not exist");
}
}
else {
System.out.println("User does not exist");
}
}
else if(option.equals("3")) {
// show list of contents in store
store.showContent();
}
else if(option.equals("4")) {
// get user ID
System.out.print("Enter user ID: ");
String userID=scanner.nextLine();
// determine user object from ID
User user=store.getUser(userID);
// check if user exist and display list of contents bought
if(user!=null) {
user.showContentBought();
}
else {
System.out.println("User does not exist");
}
}
else if(option.equals("5")) {
// get content ID
System.out.print("Enter content ID: ");
String contentID=scanner.nextLine();
// determine comtent object from ID
Content content=store.getContent(contentID);
// check if content exist and display its reviews
if(content!=null) {
content.showReviews();
}
else {
System.out.println("Content does not exist");
}
}
else if(option.equals("6")) {
loop=false;
}
else{
System.out.println("Option entered does not exist");
}
}
scanner.close();
}
}
ORDER NEW COPY OF COSC2531 PROGRAMMING FUNDAMENTALS ASSIGNMENT AND SECURE HIGHER MARKS!
Get our RMIT University, Australia Assignment Help services for major related courses and academic units such as -
- COSC2784 Discrete Structures in Computing Assignment Help
- COSC2758 Further Web Programming Assignment Help
- COSC2752 Programming Fundamentals for Scientists Assignment Help
- COSC2755 Programming Internet of Things Assignment Help
- COSC2738 Practical Data Science Assignment Help
- COSC2675 Rapid Application Development Assignment Help
- COSC2670 Practical Data Science with Python Assignment Help
- COSC2615 Advanced Professional Development Assignment Help
- COSC2627 Discrete Structures in Computing Assignment Help
- COSC2536 Security in Computing and Information Technology Assignment Help
- COSC2473 Introduction to Computer Systems Assignment Help
- COSC2406 Database Systems Assignment Help
- COSC2391 Further Programming Assignment Help
- COSC2737 IT Infrastructure and Security Assignment Help
- COSC2123 Algorithms and Analysis Assignment Help
- COSC1147 Professional Computing Practice Assignment Help
- COSC1078 Introduction to Information Technology Assignment Help
- COSC1076 Advanced Programming Techniques Assignment Help
- COSC1519 Introduction to Programming Assignment Help
- COSC1295 Advanced Programming Assignment Help