Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Create a package called pack1 2. Inside the package create an abstract class called TAX 3. Inside TAX class create an abstract function called
1. Create a package called pack1 2. Inside the package create an abstract class called TAX 3. Inside TAX class create an abstract function called Calc(); 4. Outside the package create a class that inherits TAX class (remember you must import pack1 to access TAX class) 5. Rewrite function Calc () by asking the user to Enter the price to calculate tax 6. Use this function to calculate the tax double total =(x0.15)+x; 7. Use try and catch to handle the exception that can be happened when the user enters an index number out of the bound. The output should be similar to this: Enter price 100 The final price after adding tax 115.0 LAB 6 1- copy the code and paste it in the main0 method: JFrame framl=new JFrame (); franl, settitle ( "myFrame"); frami, setsize 400,300); fram1. setLayout ( nulli); frani. setDefaultcloseoperation (JFrame. EXIT_ON_CLOSE); franl. setlocationRelativeTo (nu11); fram1, setvisible (true); 0.5 mark 2- create an object from the built-in class Jbutton. 0.5 mark 3- using the object name of the button call this method: YourObjName.setBounds(50,50,90,50); 0.5 mark 4- using the object name of the button call this method to set the color of the button: YourObjName.setBackground(new Color (1,1,1)); 5. then choose a color as the figure show: 6- then run the program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started