Question: create two classes to work together. Computer.java and ComputerException.java 1 toString method, This method returns a String to be printed and takes no parameters. When

1 toString method, This method returns a String to be printed and takes no parameters. When printing the computer object you MUST make sure that instead of 1, it prints "Windows", instead of 2 it prints "MacOS" and instead of 3 it should print "Linux". If statements are allowed in toString methods. - 1 constructor method that validates the instance variables by calling the set methods. The call to set methods is to make sure that the parameters sent are valid while not duplicating code. - This constructor should take four instance variables as parameters, barcode,os, price and model. - Make sure that the parameters are in the following order (int barcode, int os, double price, String model). Not respecting this order will result in a deduction of at least 10 points). - Overall program structure, naming conventions and style, following the Java coding standards ComputerException.java instance variable: String message This class must have the following methods: - 1 constructor, no parameters. - 1 set method void setMessage (String message) - 1 get method String getMessage() - Overall program structure, naming conventions and style, following the Java coding standards You may create a driver class to test your code. You do not need to submit the driver class with this assignment. The driver class is part of the next assignment. Computer.java ( Instance variables and validity restrictions private int barcode; integer ranges between 10001 and 99999 private int os; integer ranging from 1 to 3 (inclusive). 1 is for Windows, 2 for MacOS, 3 for Linux private double price; double ranging from $50.00 to $25,000.00 private String model; must be at least 2 non-blank characters long This class must have the following methods - 4 set methods, one per instance variable. 10 points each method = These methods should validate the parameters and must call the ComputerException if the parameters sent are invalid. - The method names should be as specified below. - Parameter names are up to you but the methods should take the parameter data type as indicated. - Follow the Java coding standards - 4 Set/mutator methods that must validate the parameters. - setBarcode(int barcode) - setOs(int os) - setPrice(double price) - setModel(String model) - 4 get methods, these methods as you should know returns the value of an instance variable. You should know what the respective return data type for each one is. - getBarcode() - getOs( ) getPrice() - getModel()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
