Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a/pid-172774-dt-forum-rid-61474931 1/courses/IS-2031-003-24206-201920/Chapter%2079%20LEs/LE 72 12 IS 2031: LE 7.2 Sections Lab Day DUE DATE 001, 002, 003M Purpose: To learn how to create and use stand-alone

a/pid-172774-dt-forum-rid-61474931 1/courses/IS-2031-003-24206-201920/Chapter%2079%20LEs/LE 72 12 IS 2031: LE 7.2 Sections Lab Day DUE DATE 001, 002, 003M Purpose: To learn how to create and use stand-alone class programs (classes without a main method) When you take code out of the application class and putit in a class of its own, you make it reusable. Prep Work: Chapter 7 Figure 7.6 shows you how an application class uses the services of a Java class in Figure 7.5. Although the code for LE 7.2 is different than the code in these figures, the concept is the same. Lab Exercise 7.2 Instructions: Relocate the code for LE 5.2 in a separate class file without a main(). Name the class Movies. In this class 1. Code a no-args (empty) constructor 2. Copy only the Scanner input as the field from LE 5.2. The field is to be private and non-static (ie, leave out the word-static") 3. Copy all the methods from LE 5.2, except for the 4. Make the methods non-static. 5. Be attentive to your import statement(s). main). In a separate file called YourLastNameFirstinitialLE72 java, copy the main) from LE 5.2 Store this file in the same location as the Movies java file. In the main() 1. Instantiate an object of the Movies class. 2. Youll use the empty constructor for the Movies class to create the object 3. Use the object to call the methods, but call the setMovieGenre) right after setMovie Title() to avoid implementing an empty call to input.nextLine). 4. Dont forget to end the main) with an exit statement. 5. So except for instantiating the Movies class object, all the code from the main) in LE 5.2 is the same other than using the object to call the methods and the slight difference in the order of the method calls 6. Be attentive to your import statement(s). ProgramName referenceVariableName new ProgramNameo referenceVariableName.methodName0 /pic 172774-dt-forum-rid-61474931-1/courses/w?031-003-24206-201920'Chapter%207%20LES LE SAMPLE OUTPUT - EXCEPT FOR SLIGHT DIFFERENCE IN ORDER OF PROMPTS, EXACTLY SAME AS LE 5.2 Enter the movie title: How to Train Your Dragon: The Hidden World Enter the movie's genre: Animation Enter the movie's release year: 2019 Enter the price of a movie ticket: 9 Enter the movie's production budget without the This prompt is separated into trailing zeroes, e.g. $5,000,000 is entered as 5: 129 2 lines. MOVIE BREAK-EVEN POINT IN TICKETS "Basis: $9.00 per Ticket Movie: How to Train Your Dragon: The Hidden World Year Released: 2019 Genre: Animation rroduction Budget: $129.0 million Break-Even Ticket Sales: 14,333,333

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Core Ios Developer S Cookbook Core Recipes For Programmers

Authors: Erica Sadun ,Rich Wardwell

5th Edition

0321948106, 978-0321948106

More Books

Students also viewed these Programming questions