The object class should be a Student with the following attributes:
id: integer
first name: String
last name: String
write the accessors, mutators, constructor, and toString().
In your main test class you will write your main method and do the following things:
Create an array of Student objects with at least 5 students in your array.
Write a sort method that must be your original work and included in the main class. The sort
method will sort based on student id.
Output the array out in unsorted order as it exists.
Sort the array
Output the sorted array
/*
* Student.h file
*/
#ifndef STUDENT_H
#define STUDENT_H
#include "Student.h"
#include <bits/stdc++.h>
using namespace std;
class Student
{
private:
int id;
string firstName;
string lastName;
public:
Student(int i, string fname, string lname);
int getId();
string getFirstName();
string getLastName();
void setId(int i);
void setFirstName(string fname);
void setLastName(string lname);
string toString();
};
#endif
/*
* Student.cpp file
*/
#include "Student.h"
#include <bits/stdc++.h>
using namespace std;
Student :: Student(int i, string fname, string lname)
{
id = i;
firstName = fname;
lastName = lname;
}
int Student :: getId()
{
return id;
}
string Student :: getFirstName()
{
return firstName;
}
string Student :: getLastName()
{
return lastName;
}
void Student :: setId(int i)
{
id = i;
}
void Student :: setFirstName(string fname)
{
firstName = fname;
}
void Student :: setLastName(string lname)
{
lastName = lname;
}
string Student :: toString()
{
//return firstName + ", " + lastName;
return to_string(id) + ", " + firstName + ", " + lastName;
}
/*
* Main.cpp file
*/
#include <bits/stdc++.h>
using namespace std;
#define MAX 5
#include "Student.h"
bool comp(Student& lhs, Student& rhs)
{
return lhs.getId() < rhs.getId();
}
int main()
{
Student studArray[MAX] = {Student(4,"Bob","Marley"), Student(3, "Ino","Nokia"), Student(5,"Peter","Parker"), Student(2,"Ibu","Hatela"),Student(1,"Ghan","Shyam")};
cout << "Student Array Before -" << endl;
for (int i = 0; i < MAX; i++)
{
cout << studArray[i].toString();
cout << endl;
}
sort(studArray, studArray + MAX, comp);
cout << endl << "Student Array After -" << endl;
for (int i = 0; i < MAX; i++)
{
cout << studArray[i].toString();
cout << endl;
}
return 0;
}

The object class should be a Student with the following attributes: id: integer first name: String...
1. Do the following a. Write a class Student that has the following attributes: - name: String, the student's name ("Last, First" format) - enrollment date (a Date object) The Student class provides a constructor that saves the student's name and enrollment date. Student(String name, Date whenEnrolled) The Student class provides accessors for the name and enrollment date. Make sure the class is immutable. Be careful with that Date field -- remember what to do when sharing mutable instance variables...
Create a java class for an object called Student which contains the following private attributes: a given name (String), a surname (family name) (String), a student ID number (an 8 digit number, String or int) which does not begin with 0. There should be a constructor that accepts two name parameters (given and family names) and an overloaded constructor accepting two name parameters and a student number. The constructor taking two parameters should assign a random number of 8 digits....
IN JAVA Write a class Store which includes the attributes: store name, city. Write another class encapsulating an Art Gallery, which inherits from Store. An Art Gallery has the following additional attributes: how many paintings are sold every year and the number of artists submitting artwork. Code the constructor, accessors, mutators, toString and equals method of the super class Store. Code the constructor, accessors and mutators for the subclass Art Gallery. In the Art Gallery class, also code a method...
Antique Class Each Antique object being sold by a Merchant and will have the following attributes: name (string) price (float) And will have the following member functions: mutators (setName, setPrice) accessors (getName, getPrice) default constructor that sets name to "" (blank string) and price to 0 when a new Antique object is created a function toString that returns a string with the antique information in the following format <Antique.name>: $<price.2digits> Merchant Class A Merchant class will be able to hold...
Write a class Store which includes the attributes: store name, city. Write another class encapsulating an Art Gallery, which inherits from Store. An Art Gallery has the following additional attributes: how many paintings are sold every year and the number of artists submitting artwork. Code the constructor, accessors, mutators, toString and equals method of the super class Store. Code the constructor, accessors and mutators for the subclass Art Gallery. In the Art Gallery class, also code a method returning the...
Create a class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address (string) Employee home city (string) Employee home state (string) Write a constructor to initialize the above Employee attributes. Create another class HourlyEmployee that inherits from the Employee class. HourEmployee must use the inherited parent class variables and add in HourlyRate and HoursWorked. Your HourEmployee class should contain a constructor that calls the constructor from the...
[JAVA] Program: Design a Ship class that the following members: A field for the name of the ship (a string) o A field for the year the the ship was built (a string) o A constructor and appropriate accessors and mutators A toString method that displays the ship's name and the year it was built Design a CruiseShip class that extends the Ship class. The CruiseShip class should have the following members: A field for the maximum number of passengers...
Create an abstract class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address (string) Employee home city (string) Employee home state (string) Write a constructor to initialize the above Employee attributes. Create an abstract method called earnings. Create another class HourlyEmployee that inherits from the abstract Employee class. HourEmployee must use the inherited parent class variables and add in attributes HourlyRate and HoursWorked. Your HourEmployee class should...
Create an abstract class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address (string) Employee home city (string) Employee home state (string) Write a constructor to initialize the above Employee attributes. Create an abstract method called earnings. Create another class HourlyEmployee that inherits from the abstract Employee class. HourEmployee must use the inherited parent class variables and add in attributes HourlyRate and HoursWorked. Your HourEmployee class should...
Student class: Instance variables name id Constructors: Default constructor Constructor that has id and name passed to the constructor Methods: Accessors int getID( ) String getName( ) Class Roster: This class will implement the functionality of all roster for school. Instance Variables a final int MAX_NUM representing the maximum number of students allowed on the roster an ArrayList storing students Constructors a default constructor should initialize the list to empty strings a single parameter constructor that takes an ArrayList<Student> Both...