Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ADD IN ANSWERS TO ALL OF THE TO-DO's public class App private String name private String author; privste double price; privete int rating; // velid
ADD IN ANSWERS TO ALL OF THE TO-DO's
public class App private String name private String author; privste double price; privete int rating; // velid ratings are 1-4 or e meaning not reted * Create an app with the given name, author, price, and rating * @param appName the app name * @param sppAuthor the app author * Eperam sppPrice the price of the spp (8 if the spp is free) * Eparam appRating the app's rating */ public App(String appName, String sppAuthor, double appPrice, int appRating) pNa; suthor = appAuthor; price = appPrice; rsting = appRating; // TODO: ----------------- 1 ------------------- // TODO: Create a second constructor thet takes 3 paremeters: appName, sppAuthor and appPrice // TODO: Update the corresponding 3 fields from the perameters // TODO: Set the rating to 0 // TODO: Hint: start by copying and pasting the constructor above, then update s8 necessary // TODO: Don t forget the comment header! /** * Breturn the spp name public String getName() return name; /** * Creturn the spp suthor */ public String getAuthor () return author; /** * Breturn the app price */ public double getPrice () return price; * Set the price of this spp to the value given * eparam newPrice new price for this app */ public void setPrice(double newPrice) price = newPrice: 2 -- --------- -- // TODO: Create the getReting method thet returns this app's rating /I TODO: Don't forget the comment header! // TODO: ---------- 3 ---- // TODO: Create the setReting method thet sets the rating of this app to a new value // TODO: Hint: This method should take the new rating ss a parameter; nothing should be returned // TODO: Don't forget the comment header! /** * Reset the rating of this app to not rated */ public void resetRating () rating = 0; * Increase the rating of this spp by 1 */ public void increaseRating() // TODO: ----------------- 4 ------------------- // TODO: Thia method doean t work ss intended. Fix it. rating = 1; // TODO: ----- ----- 5 ------------------- // TODO: Create a method called decreaseRating that decreaseas this app's reting by 1 // TODO: This method should be similar to increaseRating // TODO: Don't forget the comment header! /** * Print information on this spp */ public void printAppInfo() System.out.println("----- System.cut.println("App: System.out.println("Author: System.out.println( "Price: $ + price); // TODO // TODO: Add a line here to print this app's rating System.out.- printin("---------------------------------'); ); name) + suthor)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started