QuestionQuestion

In this program you will keep track of Students in a Course. The maximum number of students in a course is 100. There is no error method if the user tries to enter too many students. The program just does not allow the extra students to be added.

You will keep track of the course name, the names of the students, and the number of students in a course. The main method is provided for you and you will not change anything in it.

The program will be able to add students, drop students, see the name of the course and find out how many students are currently enrolled in the course.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

/**
*
* @author
*/
public class Course {

    private String courseName;
    private ArrayList<String> students = new ArrayList<>();

    public Course(String courseName){
       this.courseName = courseName;
    }

    public void addStudent(String student){
       if (students.size() < 100) {
            students.add(student);
       }
    }

    public int getNumberStudents(){
       return students.size();
    }

    public void showStudents(){
       for(int i = 0; i < students.size(); i++) {
            System.out.println(students.get(i));
       }
    }

    public String getCourseName(){
       return courseName;
    }...
$15.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats