Java:
Create a Product object: “Laptop”, $799.99
• Create a Product object: “Printer”, $219.99
• Print the information about the products
• Change the price of the laptop to $999
• Change the price of the printer to $329.99
• Print the information about the products
Product.java
public class Product{
private String item;
private double cost;
public Product(String item, double cost) {
super();
this.item = item;
this.cost = cost;
}
public String getItem() {
return item;
}
public void setItem(String item) {
this.item = item;
}
public double getCost() {
return cost;
}
public void setCost(double cost) {
this.cost = cost;
}
@Override
public String toString() {
return "Product [item=" + item + ", cost=" + cost + "]";
}
}
Driver.java
public class Driver {
public static void main(String[] args){
Product p1 = new Product("Laptop", 799.99);
Product p2 = new Product("Printer", 219.99);
System.out.println(p1);
System.out.println(p2);
p1.setCost(999);
p2.setCost(329.99);
System.out.println(p1);
System.out.println(p2);
}
}
**Comment for any further queries.?
Java: Create a Product object: “Laptop”, $799.99 • Create a Product object: “Printer”, $219.99 • Print...
Java coding. Create a class called Printer and a class called Job that will simulate a computer printer. The printer should store a queue of Job objects until they are printed. Each Job should consist of a title and the number of pages the job contains. The printer should also store the number of jobs it can print per minute. The class should include methods to add jobs and print jobs. The method that prints a job should return the...
Create a Book object using a Java program. This object should contain the following variables bookName, bookAuthorName, bookGenre. Now create 3 different book objects and store them in an array. Finally iterate through this array and print out the book names.
Java Framework Collection Assign. Create a class called ArrayListExample Create a ArrayList object called languageList which accept type of String Add English, French, Italian and Arabic strings into languageList array object Print languageList using Iterator object Sort ArrayList object alphabetically Print languageList using Iterator object Solution will produce following: ArrayListExample class ArrayList object called languageList ArrayListExampleTest class with main method
SQL QUERIES 1) Using the Product and PC relations, create both tables in your database and insert all the data. Show the SQL statements to create each table and show a representative SQL insert statement for the data in each table (i.e. you do not need to show insert statements for all the data). – For the remaining questions, assume that your SQL is part of a program function and the function provides the input needed for your SQL query....
Java program Create a Student Information System that includes the following 4 classes: Student, Courses, Instructor, and Location. Allow the user create a Student object with a course name, instructor, and location. After the user creates the object, make sure to print your Student object.
Exercise 11 - in Java please complete the following: For this exercise, you need to work on your own. In this exercise you will write the implementation of the pre-written implementation of the class CAR. The class CAR has the following data and methods listed below: . Data fields: A String model that stores the car model, and an int year that stores the year the car was built. . Default constructor . Overloaded constructor that passes values for both...
2. Create ONE java file in Dr Java according the specifications below: A. Create a Country class a. Each Country object of the Country class should know (state) i. its name ii. its area (in square miles) iii. its population b. Each Country object should be able to (behavior) i. set initial population (setter) ii. get density (number of people per square mile) (getter) iii. adjust the set population by some amount (setter) iv. provide its name, area, and population...
Programmed in Java, please use inheritance, as that is the part i'm confused on. Thanks! For this lab you are creating 4 classes: Main class Has the main method and tests the other classes. Computer We are storing the following information about our computers CPU type CPU speed RAM size Laptop We are storing the following information about our laptops All the information we have in the computer Battery life in hours The current battery level (hours remaining). Charge method...
Using Java and a mouse or keyboard listener, create an image containing some object whose color can be changed when some input is received from the keyboard or mouse. If you are adventurous, you can try inputting a color name from the keyboard and change the color to the one named in that input.