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 does for the user. Correct documentation is required
import java.util.*;
class Student
{
private String name;
private double gpa;
private int id;
Student()
{
this.name = "";
this.gpa = 0.0;
this.id = 0;
}
Student(String name)
{
this.name = name;
this.gpa = 0.0;
this.id = 0;
}
Student(String name, int id)
{
this.name = name;
this.gpa = 0.0;
this.id = id;
}
// setter methods
public void setName(String name)
{
this.name = name;
}
public void setGPA(double gpa)
{
this.gpa = gpa;
}
public void setID(int id)
{
this.id = id;
}
// getter methods
public String getName()
{
return this.name;
}
public double getGPA()
{
return this.gpa;
}
public int getID()
{
return this.id;
}
// method to print out the values
public void display()
{
System.out.printf("Name : %s\nId : %d\nGPA : %f", this.name, this.id, this.gpa);
}
}
public class Test
{
public static void main(String[] args)
{
// create an array to store object of class Student
Student[] arr = new Student[2];
Scanner sc = new Scanner(System.in);
// create a Student object
arr[0] = new Student();
System.out.println("First student ...");
System.out.print("Enter name : ");
String name1 = sc.nextLine();
arr[0].setName(name1);
System.out.print("Enter ID : ");
int id1 = sc.nextInt();
arr[0].setID(id1);
System.out.print("Enter GPA : ");
double gpa1 = sc.nextDouble();
arr[0].setGPA(gpa1);
System.out.println();
arr[0].display();
// create a Student object
arr[1] = new Student();
System.out.println("\n\nSecond student ...");
System.out.print("Enter name : ");
String name2 = sc.nextLine();
name2 = sc.nextLine();
arr[1].setName(name2);
System.out.print("Enter ID : ");
int id2 = sc.nextInt();
arr[1].setID(id2);
System.out.print("Enter GPA : ");
double gpa2 = sc.nextDouble();
arr[1].setGPA(gpa2);
System.out.println();
arr[0].display();
}
}
Sample Output

JAVA program For this project you are to create an array of objects of your choice...
JAVA I. Using the Event Class created previously, create an array of objects; II. Demonstrate passing array reference to a method; III. Demonstrate creating array of objects that prints out only x 0.0 for all objects. PROJECT 5C - ARRAYS Create a new file called " EventArray5C". There are some "challenging" directions in this project. . 1.Prepare a document box (tell me that task(s) the application is to accomplish, how it will accomplish the tasks, the author of...
For this assignment you will be creating an array of objects or a list of objects of car parts based on user input. 1. Create a Parts class with the following items a. Properties for PartNum, Part Name, Part Description, and Cost b. Must have a constructor 2. In the main you will need accomplish the following: a. Ask the user how many objects they wish to enter b. Create an array of parts objects c. Loop appropriately to collect...
Please complete this code for java
Lab Write a program as follows: Create an array with 10 elements. The array should contain numbers generated randomly between 1 and 100 Ask the user to enter any number - Search the array to see if the user entered number is in the array If the user-entered number is in the array, print a 'match found' message. Also print at which index the match was found, else print a 'match not found' message...
In this assignment you will create two Java programs: The first program will be a class that holds information (variables) about an object of your choice and provides the relevant behavior (methods) The second program will be the main program which will instantiate several objects using the class above, and will test all the functions (methods) of the class above. You cannot use any of the home assignments as your submitted assignment. Your programs must meet the following qualitative and...
Write a Java program that will create an array of Strings with 25 elements. Input Strings from the user and store them in the array until either the user enters “quit” or the array is full. HINT: the sentinel value is “quit” all lowercase. “Quit” or “QUIT” should not stop the loop. HINT: you have to use the equals method (not ==) when you are comparing two Strings. After the input is complete, print the Strings that the user entered...
Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student gradebook using a two-dimensional array. It should allow the user to enter the number of students and the number of assignments they wish to enter grades for. This input should be used in defining the two-dimensional array for your program. For example, if I say I want to enter grades for 4 students and 5 assignments, your program should define a 4 X 5...
FOR JAVA: Summary: Create a program that stores info on textbooks. The solution should be named TextBookSort.java. Include these steps: Create a class titled TextBook that contains fields for the author, title, page count, ISBN, and price. This TextBook class will also provide setter and getter methods for all fields. Save this class in a file titled TextBook.java. Create a class titled TextBookSort with an array that holds 5 instances of the TextBook class, filled without prompting the user for...
Java Project In Brief... For this Java project, you will create a Java program for a school. The purpose is to create a report containing one or more classrooms. For each classroom, the report will contain: I need a code that works, runs and the packages are working as well The room number of the classroom. The teacher and the subject assigned to the classroom. A list of students assigned to the classroom including their student id and final grade....
Code a Java program to create and use OO classes. Comment your code throughout. Create a Super class named Home Properties address SF (this is the number of Square feet) value (this is the dollar value of the home) Methods Set and get methods for all properties calcValue() - calculate the value as sf * 400 displayCondo() - displays all properties of a condo Create a sub class named Condo Properties HOAfee (home owners association fee) Methods Set and get...
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.