Question: **Java** Create a class named Tablet with - private instance variables manufacturer, model, size (in inches), and price - one constructor with 4 parameters -
**Java**
Create a class named Tablet with - private instance variables manufacturer, model, size (in inches), and price - one constructor with 4 parameters - get/set methods for each instance variable - a toString method that returns all the information about the Tablet as a String, clearly labeled. Format the screen size to one place past the decimal point. Format the price as currency. You must validate the price in the constructor and set method (no negative value allowed use default value 0.0).
Create a program TabletTest with an array named tablets that will hold 4 Tablet objects. Create 4 Tablets and store them in the array. Use literal data as arguments to the constructor. Use an enhanced for loop to display the Tablet data (call the toString method). Use the command prompt window (terminal) for output. There is NO user input. Do everything in main. Place the Tablet.java and the TabletTest.java files in a folder named final, then zip the folder and drag and drop the final.zip file below. Place your name in a comment in both files. DO NOT EMAIL ME YOUR FILES. THEY WILL NOT BE ACCEPTED.
Sample output:
Tablets Manufacturer: Samsung Model: Galaxy Tab A Size: 10.1" Price: $199.99
Manufacturer: Apple Model: iPad Size: 9.7" Price: $369.99
Manufacturer: Lenovo Model: Tab 4 10 Size: 10.1" Price: $179.00
Manufacturer: Amazon Model: Fire HD 8 Size: 8.0" Price: $69.99
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
