Microsoft Word - Assign 4 - BCS 345.docx Written by Arthur Hoskey, PhD Assignment 4 – BCS 345 Java Programming Due: 11/10/2021 @ 10:50am Submission Guidelines Create a winzip file containing the WHOLE...

1 answer below »
Attached is a Java development assignment specification and Zip file containing the material referenced. Thank you for your assistance.


Microsoft Word - Assign 4 - BCS 345.docx Written by Arthur Hoskey, PhD Assignment 4 – BCS 345 Java Programming Due: 11/10/2021 @ 10:50am Submission Guidelines Create a winzip file containing the WHOLE project directory and submit on Blackboard. IMPORTANT – Make sure you properly comment AND properly indent your program. The commenting and indenting documents are on Blackboard. If you fail to properly comment or properly indent points will be deducted. VERY IMPORTANT – IF THE PROGRAM DOES NOT COMPILE THERE WILL BE MAJOR POINTS TAKEN OFF. THIS MEANS IT WILL BE A FAILING GRADE. Overview You will be writing the ClassGrades class. There are two main parts to this assignment. 1. Write the ClassGrades class. 2. Write a console UI in main. You will NOT need to create any new projects or packages for this assignment. Packages Use the existing packages. They have been named com..business and com..presentation. Written by Arthur Hoskey, PhD Example Project/Package Setup: com.arthurhoskey.business  Package SubDate.java  Source file Student.java  Source file Submission.java  Source file ClassGrades.java  Source file com.arthurhoskey.presentation  Package Main.java  Source file Git Version Control The project directory you submit must be under Git version control. You should periodically execute commits to save your progress. You must execute at least three commits for this assignment during development. The commits should be spaced out evenly. Do not wait until the end of your development to do all the commits. Class – ClassGrades Store in business package. Member Variables (all private) Variable Data Type Description student Student The Student who we are collecting submission data for. submissions Submission[] Array of Submission. Member Method Signatures and Descriptions (all public) Signature Description Written by Arthur Hoskey, PhD Default Constructor Default constructor. Initializes member variables. void setStudent(Student w) Sets the Student member variable. Student getStudent() Gets the Student member variable. Submission getHighestScoreSubmission() Searches the array for the Submission with the highest score and returns it from the method (return does NOT mean print on screen). Submission getAt(int index) Returns the Submission at the given index. Should use the throw keyword to throw an exception if the index is invalid. Specifically, this method should throw an ArrayIndexOutOfBounds exception if the index is not valid. No value will be returned if the index is invalid, it just throws an exception. void report(PrintStream ps) Writes a report to the given PrintStream. Use the elements of the array as source of data for the report (not an input file). The report should be the exact same format as you used in assignment 1. void writeJSON(PrintStream ps) Write the member variables in JSON format to the given PrintStream. void readJSON(FileReader fr) Read the contents of all member variables from the given instance of FileReader as JSON. Assume the following: 1. FileReader is already open. 2. Member variable values are stored in JSON format. @Override String toString() This method should return a string with descriptive text and data. For example: First = Inaya, Last = Ali, Major = Computer Systems Submission Date = 9/1/2021 Assignment = Lab 1 Score = 70.0 Submission Date = 9/8/2021 Assignment = Quiz 1 Written by Arthur Hoskey, PhD Score = 85.0 Submission Date = 9/15/2021 Assignment = Homework 1 Score = 90.0 Submission Date = 9/27/2021 Assignment = Exam 1 Score = 80.0 UI Menu Description Write code in main that will present a menu to the user and then perform an action depending on what the user chooses to do. You should create ONE instance of ClassGrades inside of the main method. When the program runs it should display the menu to the user and give them a chance to input a choice. An action should be taken depending on what choice the user makes. Keep redisplaying and processing user choices until the user chooses option 7. Here is the user menu: Class Grades UI --------------- 1 – Read class grades from file as JSON 2 – Write class grades to file as JSON 3 – Show submission at index on screen 4 – Show submission with highest score on screen 5 – Show class grades report on screen 6 – Show class grades toString on screen 7 - Exit Enter Choice THE PROGRAM SHOULD KEEP SHOWING THE MENU AND PERFORMING AN ACTION UNTIL THE USER CHOOSES TO EXIT. Actions Choice Action 1 Reads in data for the instance of ClassGrades. This menu option expects data to come in according to the JSON ClassGrades file format specified at the end of the assignment. The user should be prompted to enter a filename to read from. Hint: You can use a method to help out with this. 2 Writes all data from the ClassGrades instance to a file as JSON. The user should be prompted to enter a filename to write the data to. Written by Arthur Hoskey, PhD Data should be written out according to the ClassGrades JSON file format specified at the end of this assignment. Hint: You can use a method to help out with this. 3 Show Submission at index. The user should be prompted to enter an index. All data for the Submission at that index should be displayed on the screen. If the index is invalid display a message to the user giving that information. This menu option should contain a try/catch block for an ArrayIndexOutOfBounds exception. If the user enters an invalid index an ArrayIndexOutOfBounds method should be thrown by getAt and that exception should be caught here. Hint: You will need to use the getAt method of ClassGrades to code this menu option. 4 Show Submission with highest grade. You must write code that looks through the array and finds the Submission with the highest grade. Hint: You can use a method to help out with this. 5 Show the ClassGrades report on the screen. This report should have the same format as the report from assignment 1 (see below for sample report). 6 Show what ClassGrades toString returns on screen. 7 Exit Written by Arthur Hoskey, PhD Sample ClassGrades JSON (create a file from this JSON) { "student": { "first": "Inaya", "last": "Ali", "major": "Computer Systems" }, "submissions": [ { "date": { "month": 9, "day": 1, "year": 2021 }, "assignment": "Lab 1", "score": 70.0 }, { "date": { "month": 9, "day": 8, "year": 2021 }, "assignment": "Quiz 1", "score": 85.0 }, { "date": { "month": 9, "day": 15, "year": 2021 }, "assignment": "Homework 1", "score": 90.0 }, { "date": { "month": 9, "day": 27, "year": 2021 }, "assignment": "Exam 1", "score": 80.0 } ] } Written by Arthur Hoskey, PhD Sample ClassGrades Report Student Grades -------------- First: Inaya Last : Ali Major: Computer Systems Month Day Year Assignment Numeric Grade Letter ----- --- ---- ---------- ------------- ------ 9 1 2021 Lab 1 70.00 C- 9 8 2021 Quiz 1 85.00 B 9 15 2021 Homework 1 90.00 A- 9 27 2021 Exam 1 80.00 B- Numeric Average:
Answered 1 days AfterOct 31, 2021

Answer To: Microsoft Word - Assign 4 - BCS 345.docx Written by Arthur Hoskey, PhD Assignment 4 – BCS 345 Java...

Saima answered on Nov 02 2021
102 Votes
package com.johncoloprisco.business;
import java.io.FileNotFoundException;
import java.io.FileRead
er;
import java.io.PrintStream;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.stream.JsonReader;
public class ClassGrades {
private Student student;
private Submission[] submissions;
public ClassGrades(Student student, Submission[] submissions) {
    this.student = student;
    this.submissions = submissions;
}
public Student getStudent() {
    return student;
}
public void setStudent(Student student) {
    this.student = student;
}
public Submission getHighestScoreSubmission()
{    Submission[] tempArray=submissions;
    double temp;
    int...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here