Language is C++
Assignment 8 A: Rare Collection. We can make arrays of custom objects just like we’ve done with ints and strings. While it’s possible to make both 1D and 2D arrays of objects (and more), for this assignment we’ll start you out with just one dimensional arrays. You have been commissioned to develop a program to digitally record a rare collection of LaserDisc movies. You will start by creating a LaserDisc class. It should have the following private attributes:
String movieTitle
int releaseYear
String genre
float rating
Your class should also have the following methods:
Default Constructor: Initializes the four attributes to the following default values:
◦ movieTitle = “Star Wars Holiday Special”
◦ releaseYear = 1978
◦ genre = “Science Fiction”
◦ rating = 5.0
Overloaded Constructor: Initializes the four attributes based on values passed into the formal parameters
◦ If rating is less than 0.0 or greater than 5.0, set it equal to 0.0
◦ If releaseYear is less than 1978, set it equal to 1978
bool/Boolean isItGood(): Returns “true” if rating is 3.0 or greater, and “false” otherwise.
Getter method for all class attribute
You will then create a separate class, Assignment8A. In its main method, you should do the following:
Ask the user how many movies are in their collection
Create an array (of type LaserDisc) of that size
Use a loop to ask the user to enter information for all movie
◦ Create a LaserDisc object for each movie and store it in the next index in the array
Then using another loop, you should give the user the following options:
Print movie information
◦ This should ask the user for a number, and then print the information from the LaserDisc object at that index. If the index is out of bounds, it should notify the user instead.
Recommend a good movie from the collection
◦ This should choose a random movie, check if it is a good movie based on the relevant function, and either print the information to the user or guess again if it was not a good movies If there are no good movies in the collection, tell the user that no good movies exist in the collection.
Hint: You can use a counter variable to keep track of the guesses. When you’ve guessed more times than numbers of elements in the array, you can stop. However, this means you might miss some movies if the same index is randomly selected multiple times. If you want to challenge yourself further, consider another way you could handle that situation.
Quit
◦ Ends the loop and the program
(user input is in bold)Sample Output:
[Laser Disc Collection]
How many movies do you have? 10
Movie 1:
*Enter Title: Back to the Future
*Enter Genre: Science Fiction
*Enter Release Year: 1985
*Enter Rating: 5.0
Movie 2:
*Enter Title: Twin Peaks Season 1
*Enter Genre: Mystery-Horror Serial Drama
*Enter Release Year: 1992
*Enter Rating: 4.5
//Keep going for all 10 movies (THIS IS NOT PART OF THE OUTPUT)
[Main Menu]
1) Movie Info
2) Recommend a Good Movie
3) Log off
Choice: 1
Which Movie do you want? 100
Sorry, that’s not a valid Movie index
[Main Menu]
1) Movie Info
2) Recommend a Good Movie
3) Log off
Choice: 1
Which movie do you want? 0
0. Back to the Future, 1985
Genre: Science-Fiction
Rating: 5.0
[Main Menu]
1) Movie Info
2) Recommend a Good Movie
3) Log off
Choice: 2
You should try: Dune (1984)!
It has a rating of 4.1
[Main Menu]
1) Movie Info
2) Recommend a Good Movie
3) Log off
Choice: 3
Goodbye!
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- In Python IDLE: How would I write code for the two problems in the attached image?arrow_forwardImplement the"paint fill"function that one might see on many image editing programs. That is, given a screen (represented by a two-dimensional array of colors), a point, and a new color, fill in the surrounding area until the color changes from the original color.arrow_forwardThis is needed in Java Given that an ArrayList of Strings named nameList has already been created and names have already been inserted, write the statement necessary to delete the name at index 15.arrow_forward
- THIS NEEDS TO BE DONE IN C#!! The Tourtise and The Hair In this lab, we will be simulating the classic race of the tourtise and the hare. The race will take place on two paths of 70 tiles, which spans from left to right. The path will have two lanes, one for each animal. The path will be represented as an array of 70 characters, where each character will be the following: · A dash(i.e, “-“), which represents an empty tile. · An “h”, which represents the hare on the hare lane. · A “t”, which represents the tourtise on the tortise lane. All tiles will be “empty” (i.e. set to the dash) with the exception of the tiles that are occupied by the animals. As the animals move, the previous tile the animal was on will be set to empty, and the new tile will be changed to either “h” or “t”. Tile 70 will be the finishing tile, and the first animal to that tile will be declared the winner of the race. We will use randomization to determine how far each animal will move. Since this race will be…arrow_forwardHello! I need some help with my Java homework. Please use Eclipse Please add comments to the to program so I can understand what the code is doing and learn Create a new Eclipse project named so as to include your name (eg smith15 or jones15). In this project, create a new package with the same name as the project. In this package, write a solution to the exercise noted below. Implement the following method that returns the maximum element in an array: public static <E extends Comparable<E>> E max(E[] list) Write a test program that generates 10 random integers, invokes this method to find the max, and then displays the random integers sorted smallest to largest and then prints the value returned from the method. Max sure the the last sorted and returned value as the same!arrow_forwardJava programmingarrow_forward
- This is in Java. The assignement is to create a class. I am confused on how to write de code for an array that is up to 5. Also I am confused regarding how to meet the requirements of the constructor. This is what I have. public class InventoryOnShelf { //fields private int[] itemOnShelfList []; private int size; public InventoryOnShelf() { }arrow_forwardWrite a program in java in which we had an array and you have to find Whether this array is monotonic or notarrow_forwardI need a code that demonstrates the use of the below items (Templates, overloading, and vectors). It doesn't need to be special and you can choose the example for the code. Maybe 30 - 50 lines of code that I can run in Visual Basic 2019. I just want to be able to compile it so that I understand what I am reading next week. Working examples are better than what I can pull from the single code examples in the book. Please label to help me identify. Thanks 1. Write C++ code (perhaps around 30-50 lines of code) and make it compile and run showing how to use: a. Templates b. Overloading c. Vectorsarrow_forward
- This question is in javaYou are walking along a hiking trail. On this hiking trail, there is elevation marker at every kilometer. The elevation information is represented in an array of integers. For example, if the elevation array is [100, 50, 20, 30, 50, 40], that means at kilometer 0, the elevation is 100 meters; at kilometer 1, the elevation is 50 meters; at kilometer 2, the elevation is 20 meters; at kilometer 3, the elevation is 30 meters; at kilometer 4, the elevation is 50 meters; at kilometer 5, the elevation is 40 meters. a) Write a method called dangerousDescent that determines whether there is a downhill section in the hiking trail with a slope of more than -0.05. The slope is calculated by the rise in elevation over the run in distance. For example, the last kilometer section has a gradient of -0.01 because the rise in elevation is 40 - 50 = -10 meters. The distance covered in 1000 meters. -10 / 1000 = 0.01. Your method should return true if there exists a dangerous…arrow_forwardBuild two classes (Fraction and FractionCounter) and a Driver for use in counting the number of unique fractions read from a text file. We’ll also reuse the ObjectList class we built in lab to store our list of unique FractionCounters, instead of directly using arrays or the ArrayList. Remember NO DECIMALS! Handle input of any length Introduction Your project is to read in a series of fractions from a text file, which will have each line formatted as follows: “A/B”. A sample text file is listed below, and the purpose of your program is to read in one line at a time and build a Fraction object from A and B. For each unique Fraction seen, your program will create a FractionCounter object used to track the number of occurrences of that specific fraction. When all the input is consumed, your program will print out its ObjectList of unique FractionCounters, which should report the fraction and its count – see output below. You can assume no blank lines or misleading characters; see…arrow_forwardUse the ArrayList class Add and remove objects from an ArrayList Protect from index errors when removing Practice with input loop Details: This homework is for you to get practice adding and removing objects from an ArrayList. The Voter class was used to create instances of Voters which held their name and a voter identification number as instance variables, and the number of instances created as a static variable. This was the class diagram: The constructor takes a string, passed to the parameter n, which is the name of the voter and which should be assigned to the name instance variable. Every time a new voter is created, the static variable nVoters should be incremented. Also, every time a new voter is created, a new voterID should be constructed by concatenating the string “HI” with the value of nVoters and the length of the name. For example, if the second voter is named “Clark Kent”, then the voterID should be “HI210” because 2 is the value of nVoters and 10 is the number…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY