Question 3 Each data element of the listOfBooks array created above will need to be an...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 3 Each data element of the listOfBooks array created above will need to be an instance of BN_Books. In order to start working with the variables of BN_Books, such as name, author, etc., we must create a new instance for each array element with the following code: for (int listIdx=0; list|dx < listOfBooks.length; listIdx++) { } O listOfBooks[listldx] = 0; O listOfBooks[listldx] = new BN_Book(); O listOfBooks[listldx] = just one BN_Book(); O none of the above Question 4 2 pts O True After I create the list with the array and each element now points to a new instance of BN_Books, I can run a method for any array element like this: listOfBooks[0].set_bookName("Java for fun"); O False 1 pts Question 6 Use the skills in the video above to: 1. Create a class definition called StarRating with these instance variables: -userRating: int - Review: String Notes: the userRating is a whole number so a user can only rate 3 or 4 starts but not, 3.5 1. Add the setters and getters. 2. Add logic to the setter methods such that: o the userRating is entered by the user and can only be between 1 and 5. If the user enters any other number, set the userRating = 1. o the Review is entered by the user and can only be a single, short sentence. 3. Add the default constructor 100 pts 4. Add the constructor with all instance variables as parar 5. Add a private helper method call Draw. The draw method should take no parameters and will return nothing. The purpose of draw will be to print as many asterisks (*) as the value in the User Rating variable. Use a for loop. Suppose, userRating = 4, then the Draw method should print 4 asterisks (****) on one line. There will never be a userRating of O because of the logic you added in step #3 above. Draw should be written such that the output looks like this: outputOfDraw.jpg 6. *If Draw is private, how are you going to call it from an outside class? If you need to, you can add a driver file to test this class but you are not required to! No Demo or driver file is needed at this time. Upload your StarRating.java file here. Upload Choose a File n Question 9 1. Review the technique taught to you in the videos above. 2. For the 2 class definitions described below, you will need to create a new class and include the following items: 100 pts UML in comments o private instance variables o default constructor ensuring that a new StarRatings() gets constructed as well. 1 constructor with all instance variables as parameters ensuring that the StarRatings variable is included. o setter methods o getter methods writeOutput() helper method o equals method comparing only the musicName for the MusicPiece class and MovieName for the Movie class toString method 3. Implement Class definition called MusicPiece with the following instance variables. Make them private. Complete the checklist provided in step#2 - Music Name: String -Genre: String - Length: double - JudgeReview: StarRating 4. Implement Class definition called Movie with the following instance variables. Make them private. Complete the checklist provided in step#2. - MovieName: String o - Movie length: double - CriticReview: StarRating If you need to, you can add a driver file to test these class but No Demo or driver file is needed. are not required to! Upload Choose a File This question requires that you upload the MusicPiece.java and Movie.java files. However, canvas does not let you upload 2 files here. Create a compressed .zip file. The compressed zip file will include these 2 files. Upload the .zip file here. Question 10 The class definitions we built so far can be rated with stars. Air conditioners can be rated, Music Pieces can be rated, Movies can be rated. Pick any personal topic that you are passionate about? 1. Review the technique taught to you in the videos above. 2. Decide on one item or entity from your personal topic that can be rated with star reviews. My item/entity example was in the video. It was the CraftProjects example. 3. Create a new class for your personal item/entity and include the following items: UML in comments private instance variables o default constructor 1 constructor with all instance variables as parameters o setter methods getter methods o writeOutput() helper method 100 pts equals method comparing what you think is meaningful. For my example, it was the theme instance variable that compared equality o toString method 4. For your class definition, pick no more than 3 characteristics that describe that entity. Make those characteristics instance variables. Make sure you use a variety of data types here. (String, int, double, etc.) 5. Add an instance variable called CriticRating: StarRating like I did in the CraftsProject example. 6. Edit the default constructor to ensure that a new StarRatings() gets created. 7. Edit the parameter constructor to ensure that the ensuring that the StarRatings variable is included. If you need to, you can add a driver file to test these class but you are not required to! No Demo or driver file is needed. Upload your . java class definition here. Upload Choose a File Question 1 A variable with a class data type holds an Address that points to an instance of the data. O True O False Question 2 The BN_Books class definition looks like this: public class BN_Books { } O //Add some characteristics that describe a book //INSTANCE VARIABLES O True O False //METHODS //SETTER METHOD public void set_bookName(String initial_bookName) { } private String bookName; public String Author; double price; public boolean isPopular; public int publishedYear; if (Author.equals("JK Rowling")) else } bookName = "not interested"; bookName = initial_bookName; //GETTER METHOD public String get_bookName() { Is the following true? In a main method or any other method, an array of BN_Books created like this BN_Books[] listOfBooks = new BN_Books[3]; //keyword to return from a method return bookName; } public double calc_Totalprice(int quantity) { return price* quantity; will create a list for 3 BN_Books. 1 pts 1 pts Attempt due: May 4 0 Minutes, 41 S. Question 3 Each data element of the listOfBooks array created above will need to be an instance of BN_Books. In order to start working with the variables of BN_Books, such as name, author, etc., we must create a new instance for each array element with the following code: for (int listIdx=0; list|dx < listOfBooks.length; listIdx++) { } O listOfBooks[listldx] = 0; O listOfBooks[listldx] = new BN_Book(); O listOfBooks[listldx] = just one BN_Book(); O none of the above Question 4 2 pts O True After I create the list with the array and each element now points to a new instance of BN_Books, I can run a method for any array element like this: listOfBooks[0].set_bookName("Java for fun"); O False 1 pts Question 3 Each data element of the listOfBooks array created above will need to be an instance of BN_Books. In order to start working with the variables of BN_Books, such as name, author, etc., we must create a new instance for each array element with the following code: for (int listIdx=0; list|dx < listOfBooks.length; listIdx++) { } O listOfBooks[listldx] = 0; O listOfBooks[listldx] = new BN_Book(); O listOfBooks[listldx] = just one BN_Book(); O none of the above Question 4 2 pts O True After I create the list with the array and each element now points to a new instance of BN_Books, I can run a method for any array element like this: listOfBooks[0].set_bookName("Java for fun"); O False 1 pts Question 6 Use the skills in the video above to: 1. Create a class definition called StarRating with these instance variables: -userRating: int - Review: String Notes: the userRating is a whole number so a user can only rate 3 or 4 starts but not, 3.5 1. Add the setters and getters. 2. Add logic to the setter methods such that: o the userRating is entered by the user and can only be between 1 and 5. If the user enters any other number, set the userRating = 1. o the Review is entered by the user and can only be a single, short sentence. 3. Add the default constructor 100 pts 4. Add the constructor with all instance variables as parar 5. Add a private helper method call Draw. The draw method should take no parameters and will return nothing. The purpose of draw will be to print as many asterisks (*) as the value in the User Rating variable. Use a for loop. Suppose, userRating = 4, then the Draw method should print 4 asterisks (****) on one line. There will never be a userRating of O because of the logic you added in step #3 above. Draw should be written such that the output looks like this: outputOfDraw.jpg 6. *If Draw is private, how are you going to call it from an outside class? If you need to, you can add a driver file to test this class but you are not required to! No Demo or driver file is needed at this time. Upload your StarRating.java file here. Upload Choose a File Question 6 Use the skills in the video above to: 1. Create a class definition called StarRating with these instance variables: -userRating: int - Review: String Notes: the userRating is a whole number so a user can only rate 3 or 4 starts but not, 3.5 1. Add the setters and getters. 2. Add logic to the setter methods such that: o the userRating is entered by the user and can only be between 1 and 5. If the user enters any other number, set the userRating = 1. o the Review is entered by the user and can only be a single, short sentence. 3. Add the default constructor 100 pts 4. Add the constructor with all instance variables as parar 5. Add a private helper method call Draw. The draw method should take no parameters and will return nothing. The purpose of draw will be to print as many asterisks (*) as the value in the User Rating variable. Use a for loop. Suppose, userRating = 4, then the Draw method should print 4 asterisks (****) on one line. There will never be a userRating of O because of the logic you added in step #3 above. Draw should be written such that the output looks like this: outputOfDraw.jpg 6. *If Draw is private, how are you going to call it from an outside class? If you need to, you can add a driver file to test this class but you are not required to! No Demo or driver file is needed at this time. Upload your StarRating.java file here. Upload Choose a File n Question 9 1. Review the technique taught to you in the videos above. 2. For the 2 class definitions described below, you will need to create a new class and include the following items: 100 pts UML in comments o private instance variables o default constructor ensuring that a new StarRatings() gets constructed as well. 1 constructor with all instance variables as parameters ensuring that the StarRatings variable is included. o setter methods o getter methods writeOutput() helper method o equals method comparing only the musicName for the MusicPiece class and MovieName for the Movie class toString method 3. Implement Class definition called MusicPiece with the following instance variables. Make them private. Complete the checklist provided in step#2 - Music Name: String -Genre: String - Length: double - JudgeReview: StarRating 4. Implement Class definition called Movie with the following instance variables. Make them private. Complete the checklist provided in step#2. - MovieName: String o - Movie length: double - CriticReview: StarRating If you need to, you can add a driver file to test these class but No Demo or driver file is needed. are not required to! Upload Choose a File This question requires that you upload the MusicPiece.java and Movie.java files. However, canvas does not let you upload 2 files here. Create a compressed .zip file. The compressed zip file will include these 2 files. Upload the .zip file here. n Question 9 1. Review the technique taught to you in the videos above. 2. For the 2 class definitions described below, you will need to create a new class and include the following items: 100 pts UML in comments o private instance variables o default constructor ensuring that a new StarRatings() gets constructed as well. 1 constructor with all instance variables as parameters ensuring that the StarRatings variable is included. o setter methods o getter methods writeOutput() helper method o equals method comparing only the musicName for the MusicPiece class and MovieName for the Movie class toString method 3. Implement Class definition called MusicPiece with the following instance variables. Make them private. Complete the checklist provided in step#2 - Music Name: String -Genre: String - Length: double - JudgeReview: StarRating 4. Implement Class definition called Movie with the following instance variables. Make them private. Complete the checklist provided in step#2. - MovieName: String o - Movie length: double - CriticReview: StarRating If you need to, you can add a driver file to test these class but No Demo or driver file is needed. are not required to! Upload Choose a File This question requires that you upload the MusicPiece.java and Movie.java files. However, canvas does not let you upload 2 files here. Create a compressed .zip file. The compressed zip file will include these 2 files. Upload the .zip file here. Question 10 The class definitions we built so far can be rated with stars. Air conditioners can be rated, Music Pieces can be rated, Movies can be rated. Pick any personal topic that you are passionate about? 1. Review the technique taught to you in the videos above. 2. Decide on one item or entity from your personal topic that can be rated with star reviews. My item/entity example was in the video. It was the CraftProjects example. 3. Create a new class for your personal item/entity and include the following items: UML in comments private instance variables o default constructor 1 constructor with all instance variables as parameters o setter methods getter methods o writeOutput() helper method 100 pts equals method comparing what you think is meaningful. For my example, it was the theme instance variable that compared equality o toString method 4. For your class definition, pick no more than 3 characteristics that describe that entity. Make those characteristics instance variables. Make sure you use a variety of data types here. (String, int, double, etc.) 5. Add an instance variable called CriticRating: StarRating like I did in the CraftsProject example. 6. Edit the default constructor to ensure that a new StarRatings() gets created. 7. Edit the parameter constructor to ensure that the ensuring that the StarRatings variable is included. If you need to, you can add a driver file to test these class but you are not required to! No Demo or driver file is needed. Upload your . java class definition here. Upload Choose a File Question 10 The class definitions we built so far can be rated with stars. Air conditioners can be rated, Music Pieces can be rated, Movies can be rated. Pick any personal topic that you are passionate about? 1. Review the technique taught to you in the videos above. 2. Decide on one item or entity from your personal topic that can be rated with star reviews. My item/entity example was in the video. It was the CraftProjects example. 3. Create a new class for your personal item/entity and include the following items: UML in comments private instance variables o default constructor 1 constructor with all instance variables as parameters o setter methods getter methods o writeOutput() helper method 100 pts equals method comparing what you think is meaningful. For my example, it was the theme instance variable that compared equality o toString method 4. For your class definition, pick no more than 3 characteristics that describe that entity. Make those characteristics instance variables. Make sure you use a variety of data types here. (String, int, double, etc.) 5. Add an instance variable called CriticRating: StarRating like I did in the CraftsProject example. 6. Edit the default constructor to ensure that a new StarRatings() gets created. 7. Edit the parameter constructor to ensure that the ensuring that the StarRatings variable is included. If you need to, you can add a driver file to test these class but you are not required to! No Demo or driver file is needed. Upload your . java class definition here. Upload Choose a File Question 1 A variable with a class data type holds an Address that points to an instance of the data. O True O False Question 2 The BN_Books class definition looks like this: public class BN_Books { } O //Add some characteristics that describe a book //INSTANCE VARIABLES O True O False //METHODS //SETTER METHOD public void set_bookName(String initial_bookName) { } private String bookName; public String Author; double price; public boolean isPopular; public int publishedYear; if (Author.equals("JK Rowling")) else } bookName = "not interested"; bookName = initial_bookName; //GETTER METHOD public String get_bookName() { Is the following true? In a main method or any other method, an array of BN_Books created like this BN_Books[] listOfBooks = new BN_Books[3]; //keyword to return from a method return bookName; } public double calc_Totalprice(int quantity) { return price* quantity; will create a list for 3 BN_Books. 1 pts 1 pts Attempt due: May 4 0 Minutes, 41 S. Question 1 A variable with a class data type holds an Address that points to an instance of the data. O True O False Question 2 The BN_Books class definition looks like this: public class BN_Books { } O //Add some characteristics that describe a book //INSTANCE VARIABLES O True O False //METHODS //SETTER METHOD public void set_bookName(String initial_bookName) { } private String bookName; public String Author; double price; public boolean isPopular; public int publishedYear; if (Author.equals("JK Rowling")) else } bookName = "not interested"; bookName = initial_bookName; //GETTER METHOD public String get_bookName() { Is the following true? In a main method or any other method, an array of BN_Books created like this BN_Books[] listOfBooks = new BN_Books[3]; //keyword to return from a method return bookName; } public double calc_Totalprice(int quantity) { return price* quantity; will create a list for 3 BN_Books. 1 pts 1 pts Attempt due: May 4 0 Minutes, 41 S.
Expert Answer:
Related Book For
Research Methods For Business Students
ISBN: 9781292208787
8th Edition
Authors: Mark Saunders, Philip Lewis, Adrian Thornhill
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Fletcher, Inc. disposes of under- or over-applied overhead at year-end as an adjustment to cost of goods sold. Prior to disposal, the firm reported cost of goods sold of $619,000 in a year when...
-
The following are the transactions relating to the formation of Cardinal Mowing Services, Inc., and its first month of operations. Prepare an answer sheet with the columns shown. Record each...
-
Lucas, a single U.S. citizen, works in Denmark for MNC Corp during all of 2022. His MNC salary is $187,000. Lucas may exclude from his gross income wages of: a. $0 b. $108,700 c. $112,000 d. $187,000
-
Natalie Williams is a realtor. She organized her business as a corporation, Natalie Williams, Realtor, P.C., by investing \($27,000\) cash. The business issued common stock to her. Consider the...
-
On June 30, 2017, Mischa Auer Company issued $4,000,000 face value of 13%, 20-year bonds at $4,300,920, a yield of 12%. Auer uses the effective-interest method to amortize bond premium or discount....
-
Under what conditions would you as an analyst choose to exclude some of the comparable firms from your sample?
-
Recently Santa Fe, New Mexico, was named one of the safest places to live in the United States. Since then, housing development projects have been springing up all around Santa Fe. Six housing...
-
When should base class members be declared protected? Select one: O a. The protected access specified should never be used O b. When these members are used only by member functions of this base class...
-
Shimada Products Corporation of Japan plans to introduce a new electronic component to the market at a target selling price of $ 1 5 per unit. The company is investing $ 1 1 , 8 8 0 , 0 0 0 to...
-
How do you hash a password (hardcode the password to a hash() ) which was already created in combination of the database using php/sql? $conn = mysqli_connect("localhost: 3306", "root","",""); if...
-
Platinum alloys are used for several medical applications associated with coronary artery disease due to chemical inertness, durability and electrical conductivity. The range of platinum alloy...
-
Explore the concept of advanced adaptive structures, incorporating technologies such as smart materials, actuators, and control systems, and discuss their potential applications in creating...
-
A solid copper object hangs at the bottom of a steel wire of negligible mass. The top end of the wire is fixed. When the wire is struck, it emits a sound with a fundamental frequency of 678 Hz. The...
-
A can (355 ml) of Coke has 140 "food calories" (1 foodcalorie=1Kcal). How many equivalently sized cans worth of watercould be brought to a boil using the energy in a single Coke?Assume the water is...
-
Two mutually exclusive investment alternatives are being considered. Alternative A requires an initial investment of $20,000 in a machine. Annual operating and maintenance costs are anticipated to be...
-
Which sorts of data will you need to retain and file while you are undertaking qualitative research?
-
Look through several of the academic journals that relate to your subject area. Choose an article which is based upon primary research. Assuming that the research question and objectives are not made...
-
Give three examples of different situations where you might use secondary data as part of your research.
-
Boundary-layer separation occurs when the shear stress at the surface becomes zero. Assume a polynomial representation for the laminar boundary layer of the form, \(u / U=a+b \lambda+c \lambda^{2}+d...
-
A fluid flow enters the plane-wall diffuser that has an entrance area of \(A_{o}\) at a velocity of \(U_{o}\). (a) Assuming the fluid is inviscid, determine the velocity gradient \(\frac{d U}{d x}\)...
-
A flat-bottomed barge, \(80 \mathrm{ft}\) long and \(35 \mathrm{ft}\) wide, submerged to a depth of \(5 \mathrm{ft}\), is to be pushed up a river at \(60^{\circ} \mathrm{F}\). Estimate and plot the...
Study smarter with the SolutionInn App