You are required to design a Car class which has following attributes
String brand;
Double price;
Double quantity;
String Model;
Boolean available;
1. Provide default & Parameterized constructors.
2. Provide getters & setters for data members.
3. Provide a toString() method to print values.
Now create an ArrayList of Cars in a class ShowRoom having name and address as attributes as well, Provide appropriate methods, store values in array List (take values form user).
Provide a buy method which will ask user to buy a Car by providing its name, check that it is present or not then ask for quantity and create bill for user.
After that you have to print the following
1. Add Car
2. Delete Car
3. Buy a Car.
4. Display All cars also display
· Car of brand “Audi”;
· Car with name starting with ‘L’.
· Car name end with ‘n’.
· Display only last three and first three letters of Showroom name.
class MyClassCircle {
private double radius;
MyClassCircle(double radius) {
this.radius = radius;
}
public double getArea() {
return Math.PI * radius * radius;
}
}
class GetAreaDemo {
public static void main(String [] args) {
MyClassCircle circle = new MyClassCircle(5.6);
System.out.println("Area of the circle with radius 5.6 equal to " + cicle.getArea());
}
}
1. List down the variables you used and it's uses in the program.
2. What is the formula for getting the area of the circle, based on the codes?
Write a menu driven application to maintain the department details of a School
using Java to demonstrate the concept of Inheritance. Your application must contain
the following functionalities along with the use of method overriding, and super
keyword. Consider the example of school of CST having three departments CSE,
AI&SD and CE.
a. For each department maintain the following details.
i. deptName
ii. hodName
iii. noOfFaculty
iv. noOfStudents
v. noOfPrograms
b. Get the department details from user(admin)
c. Display the Department list with all details in a proper and neat format.
d. In the menu give an option to display department wise details.
Do you like reading books? If you do, then you must have encountered texts that have quite a wide space with dots in between them, just like pausing or thinking before proceeding the narration. Let's try doing that here in C, shall we?
Input
Two lines containing a string on each.
Cody
Handsome
Output
Multiple lines containing a string on each.
Cody
Handsome
Write a Java program to create a new string taking first and last characters from two given strings. If the length of either string is 0 use "#" for missing character.
Write a Java program that creates an Array of string values and displays the duplicate values.
Write a Java program that prompts the user to input numbers in two matrices of the same size and compute the sum of the matrices
Write a java program that creates an array of 10 elements size. Your program should prompt the user to input numbers in array and then display the sum of all array elements
Develop a Java GUI application that will display the ink cartridge usage of three different printers with a time span of three years.
Q.1.1 On the form, create two combo boxes, to allow a user to select between three different printers and years. When a user has selected a printer and year and clicked the submit button, display the amount of ink cartridges used for that year. Use the following table for the printers and yearly cartridges used: 2018 2019 2020 HP Deskjet 650 10 35 20 Epson K750 15 22 12 Canon Z100 30 31 33
Q.1.2 You are also required to create a menu system which will allow the user to exit the application under the file menu. Under the tool’s menu, allow the form submission and an option to display the yearly ink cartridges used for each printer. The layout of the form is left to your discretion.
Q.1.3 The application must display a report of each printer and the total ink cartridge used for the three different years.
Write a program to read and write an object to file.