Can you fix this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can you fix this code

//Movie display// public class Movie{ String title; int rating; String genre; void playIt(){System.out.println("The movie is playing " + title); } } public class MovieTestDrive{ public static void main(String[]args){ Movie one=new Movie(); one.title="After we collided"; one.rating=20; one.genre="Romance"; one.main character="Josephine Langford,Hero Fiennes Tiffin"; Movie two=new Movie(); two.title="Taken"; two.rating=25; two.genre="Action"; two.playIt(); two.main character="Neeson"; Movie three=new Movie(); three.title="Mang Kepweng"; three.rating=35; three.genre="Comedy"; three.main character="Vhong Navaro"; Movie four=new Movie(); four.title="Game of thrones"; four.rating=30; four.genre="War"; four.main character ="Jon Snow"; Movie five=new Movie(); five.title="The Conjuring"; five.rating=45; five.genre="Horror"; five.main character="Bathsheba Sherman"; } }

17th Nov 2021, 2:31 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
16 Answers
+ 2
Ur code errors could be easily known through the console output. try reading the errors to understsnd the problem. here is the fix -> https://code.sololearn.com/cx6xRuWXfmQn/?ref=app
17th Nov 2021, 2:46 AM
ACE
ACE - avatar
+ 1
Mirasol Sontousidad is it running test cases?
17th Nov 2021, 3:34 AM
ACE
ACE - avatar
0
Please
17th Nov 2021, 2:40 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
That's the question
17th Nov 2021, 3:03 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
The question is Create a program that asks for five movie titles and stores them in an array called titles. It then asks for the main character of each movie and stores them in another array called actors. Then outputs a list of the contents of another array called movies which contain the first two arrays.
17th Nov 2021, 3:03 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
So the output should display one movie?
17th Nov 2021, 3:04 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
The sample out is the 2nd movie which is the Taken
17th Nov 2021, 3:14 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
Mirasol Sontousidad plz show the link for the problem.
17th Nov 2021, 3:24 AM
ACE
ACE - avatar
0
Create a program that asks for five movie titles and stores them in an array called titles. It then asks for the main character of each movie and stores them in another array called actors. Then outputs a list of the contents of another array called movies which contain the first two arrays.
17th Nov 2021, 3:25 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
That is the problem
17th Nov 2021, 3:26 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
Yeah
17th Nov 2021, 3:35 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
i think u just have to merge the contents of two array, titles and actors in another array movies, and then output the contents of movies array.
17th Nov 2021, 3:37 AM
ACE
ACE - avatar
0
Okay Thank you
17th Nov 2021, 3:39 AM
Mirasol Sontousidad
Mirasol Sontousidad - avatar
0
You did not put variable main character.
18th Nov 2021, 8:42 AM
Nikola Buzadzija
0
Where is the main character variable from??
18th Nov 2021, 9:55 PM
Mofya Ndabala
Mofya Ndabala - avatar