Question
Need Help with Java Code Overview Expanding upon the client/server applications that you developed in class, create a client/server application that: 1. Calculates an average
Need Help with Java Code
Overview
Expanding upon the client/server applications that you developed in class, create a client/server application that:
1. Calculates an average grade based on a set of assignment grades.
2. Determines the corresponding letter grade based on the average grade percentage. The client program and the server program should communicate over the network using messages.
The client program will collect assignment grades from the end user using the console. It will then send the grades to the server program, which will calculate the average grade percentage and determine the corresponding letter grade, both of which will be returned to the client program.
The programs should continue to run until the user indicates that they want to exit.
Objectives
Gather input from the client program's console
Display output in the client program's console and the server program's console
Create a client program using the InetAddress, Socket, BufferedReader, and PrintWriter classes
Create a server program using the Socket, BufferedReader, and PrintWriter classes
Pass messages between the client program and the server program
Process messages in both the client and server programs
Gracefully exist both programs based on user input
Use comments to internally document code
Explain the operation and structure of the application in supporting written technical documentation
Tips
The following outlines the processing that should take place in the server program:
1. Display a message stating that the server program has been started
2. Receive the messages from the client program, calculate the running total grade, and number of grades that have been sent
3. After all of the grades have been received from the client program, use the running total grade and the number of grades that have been sent to calculate the average grade
4. Determine the corresponding letter grade using the following: A=90+, B=80-89.99, C=70-79.99, D=60-69.99, F=0-59.99
5. Send the average grade percentage and corresponding letter grade to the client program with messages formatted as: Percentage grade is: (insert average grade percentage here) Letter grade is: (insert corresponding letter grade here)
6. Inform the client program that all messages have been sent with a message formatted as: X
Also, be sure to implement exception handling by catching socket exceptions and I/O exceptions. Additionally, the server program should listen for messages from the client program until the client program is terminated by the user.
The following outlines the processing that should take place in the client program:
1. Display a message stating that the client program has been started
2. Use the client program's console to prompt the user to enter individual assignment grades using the prompt:
Enter an assignment grade (as a percentage):
3. Validate each grade that is entered to ensure it is an appropriate data type (positive decimal value or 0)
4. Use the client program's console to ask the user if they would like to enter another assignment grade using the prompt: Enter Y to add another assignment grade. Enter N to calculate the final grade.
5. Continue to use the client program's console to prompt the user for input and validate that input until the user enters:
N
6. Send each grade that the user entered to the server program
7. Inform the client program that all messages have been sent with a message formatted as:
X
8. Receive the messages from the server program, and display them in the client program's console
9. After all of the messages have been received from the server program, use the client program's console to ask the user if they want to enter another set of assignment grades using the prompt:
Do you want to enter another set of grades? Enter Y to continue. Enter X to exit.
10. Continue to run the client program until the user enters:
X
The following image illustrates the server program's console output:
The following image illustrates the client program's console output (with validation):
Deliverables
You must submit all of the following to receive credit: - Lab Documentation with the following sections - Document Heading - Full name - Class and section - Assignment name (Lab 1: Client/Server App) - Date - Application Description - Detailed description of how the application, as a whole, functions - Detailed description of how each program in the application functions - Detailed discussion of the Java constructs and syntax used - Algorithm/Pseudocode - Using a combination of English and Java syntax, outline the processing of the application "HINT: Think about the processing that takes place as "steps" - Unit Testing - Discuss your testing methodology to include both positive (valid scenario/input) and negative (invalid scenario/input) test cases - Provide screenshots that illustrate the execution of at least three (3) positive test cases - Provide screenshots that illustrate the execution of at least three (3). negative test cases - Java Source Code Files - gradeCalcServer.java - Heading (full name, class and section, assignment name (Lab 1: Client/Server App), and date) - Internal documentation of code - gradeCalcClient.java - Heading (full name, class and section, assignment name (Lab 1: Client/Server App), and date) - Internal documentation of code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started