Question: MUST BE DONE USING NET BEANS AND JAVA AND FOLLOWING THE OBJECTIVES. Thank you very much please provide clear and easy to read coding Objectives

 MUST BE DONE USING NET BEANS AND JAVA AND FOLLOWING THE

OBJECTIVES. Thank you very much please provide clear and easy to read

MUST BE DONE USING NET BEANS AND JAVA AND FOLLOWING THE OBJECTIVES. Thank you very much please provide clear and easy to read coding

Objectives - Create a basic class with data members and methods Declare the instance data in the class Write the constructor for the class Write method(s) for the class Write toString() method for the class Use String class methods Create random numbers using the Math Random class Format numeric output for different purposes such as currency and percentage values Make an object from the class Create an object from the class in your driver (main) - Call the Class methods with and without parameters Instructions Write a program that does the following: 1) Create a class called Toy a) Define at three private data members that makes sense for a class called Toy. i) A string that is the name of the toy ii) You decide what this data member represents and what is the appropriate data type iii) A double representing the price of the toy b) Create a Constructor that initializes only the first and second data members using arguments i) Take the argument passed in for the name of the toy, make it uppercase using a String method, and assign it to the appropriate data member. ii) Initialize the second data member with the second argument iii) Create a random double in the range of [10.75, 20.5) and assign it the third data member representing the price of the toy. (Note, after formatting for output you can get 20.50.) c) Write the one get method to retrieve the values of the third data member as type double. d) Write one set method to set the value of the third data member. e) Write the toString method as described in class using example below. The price must be output in Currency using the FormatNumber class. In main method f) Create an instance of the Toy class passing two arguments as described above g) Call the get method for the price to retrieve the current price. h) Output the current price formatted for currency. i) Decrease the current price by 20% j) Call the set method to update the price with the new value you calculated. k) Call the toString method and output the String it returns for the instance variables. 2) Example Output. Your goal is not to make your output exactly the same as mine, as long as you follow the format for toString() as explained in chapter 3. Price before decrease: $10.91 Toy name: JUMP ROPE Color: green sparkles Price: $8.73 Objectives - Create a basic class with data members and methods Declare the instance data in the class Write the constructor for the class Write method(s) for the class Write toString() method for the class Use String class methods Create random numbers using the Math Random class Format numeric output for different purposes such as currency and percentage values Make an object from the class Create an object from the class in your driver (main) - Call the Class methods with and without parameters Instructions Write a program that does the following: 1) Create a class called Toy a) Define at three private data members that makes sense for a class called Toy. i) A string that is the name of the toy ii) You decide what this data member represents and what is the appropriate data type iii) A double representing the price of the toy b) Create a Constructor that initializes only the first and second data members using arguments i) Take the argument passed in for the name of the toy, make it uppercase using a String method, and assign it to the appropriate data member. ii) Initialize the second data member with the second argument iii) Create a random double in the range of [10.75, 20.5) and assign it the third data member representing the price of the toy. (Note, after formatting for output you can get 20.50.) c) Write the one get method to retrieve the values of the third data member as type double. d) Write one set method to set the value of the third data member. e) Write the toString method as described in class using example below. The price must be output in Currency using the FormatNumber class. In main method f) Create an instance of the Toy class passing two arguments as described above g) Call the get method for the price to retrieve the current price. h) Output the current price formatted for currency. i) Decrease the current price by 20% j) Call the set method to update the price with the new value you calculated. k) Call the toString method and output the String it returns for the instance variables. 2) Example Output. Your goal is not to make your output exactly the same as mine, as long as you follow the format for toString() as explained in chapter 3. Price before decrease: $10.91 Toy name: JUMP ROPE Color: green sparkles Price: $8.73

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!