Trending ▼   ResFinder  

programs

29 pages, 29 questions, 0 questions with responses, 0 total responses,    0    0
Prakhyat
Seshadripuram Public School (SPS), Bangalore
10
+Fave Message
 Home > prak56 >

Formatting page ...

PREVIOUS YEARS X BOARD EXAM SOLVED QUESTIONS PART-B Define a class named movieMagic with the following description: Instance variables/data members: int year to store the year of release of a movie String title to store the title of the movie. float rating to store the popularity rating of the movie. (minimum rating = 0.0 and maximum rating = 5.0) Member Methods: (i) movieMagic() Default constructor to initialize numeric data members to 0 and String data member to . (ii) void accept() To input and store year, title and rating. (iii) void display() To display the title of a movie and a message based on the rating as per the table below. RATING MESSAGE TO BE DISPLAYED 0.0 to 2.0 Flop 2.1 to 3.4 Semi-hit 3.5 to 4.5 Hit 4.6 to 5.0 Super Hit Write a main method to create an object of the class and call the above member methods. Ans. Program import java.util.Scanner; public class movieMagic { int year; String title; float rating; public movieMagic() { year = 0; title = ""; rating = 0; } public void accept() { Scanner scanner = new Scanner(System.in); System.out.print("Enter title: "); title = scanner.nextLine(); System.out.print("Enter year: "); year = scanner.nextInt(); 1

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

 

© 2010 - 2024 ResPaper. Terms of ServiceContact Us Advertise with us

 

prak56 chat