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...
JAVA program For this project you are to create an array of objects of your choice using java your Driver Class, Object Classes should all be named appropriately depending on what Classes and Objects you decide to create for this assignment. This project must give the user the ability to view and to change the elements of the array. Print your results (output) as a clear and informative statement. Your output should also include an explanation of what your program...
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...
Java Activity 1. Suppose we want to have an object-oriented design for an invoicing system, that includes invoices, one or more line items in each invoice, address of the invoice, list of products, etc. Try to design this system by indicating the required classes, responsibilities of each class, and the collaborating classes to fulfill each responsibility, and draw the CRC cards as well as UML diagram of the classes and their relationships. Then, indicate the methods of each class, provide...
Create a program in Java with the following requirements: Using a Scanner and print statements, ask the user to input 3 numbers. Use Java’s int data type…don’t worry about error checking for this assignment (assume the user doesn’t try to break your program) Store these three numbers into three variables Calculate the sum of all three numbers Calculate the product of all three numbers If all three numbers are even, output “Lucky Duck!” If all three numbers are odd, output...