Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 You will be graded based on how well you complete each of the following 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, Buffered Reader, and Print Writer 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: 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: 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: The following image illustrates the server program's console output: Server started Waiting for a connection to the client Successfully connected to the client The incoming message from the client is: 96.0 The incoming message from the client is: 95.0 The incoming message from the client is: 50.0 The incoming message from the client is: 100.0 The incoming message from the client is: 100.0 The incoming message from the client is: 75.0 Server stopped The following image illustrates the client program's console output (with validation): Client started Waiting for a connection to the server Successfully connected to the server Enter an assignment grade as a percentage: 96 Enter y to add another grade. Enter N to calculate final grade. y Enter an assignment grade as a percentage: 95 Enter y to add another grade. Enter N to calculate final grade. y Enter an assignment grade as a percentage: 50 Enter y to add another grade. Enter N to calculate final grade. n Server response is: Percentage grade is: 80% Server response is: Letter grade is: B Enter y to continue. Enter x to quit. y Enter an assignment grade as a percentage: -1 Enter an assignment grade as a percentage: x Enter an assignment grade as a percentage: 100 Enter y to add another grade. Enter N to calculate final grade. z Enter y to add another grade. Enter N to calculate final grade. Enter an assignment grade as a percentage: 100 Enter y to add another grade. Enter N to calculate final grade. y Enter an assignment grade as a percentage: 75 Enter y to add another grade. Enter N to calculate final grade. n Server response is: Percentage grade is: 92% Server response is: Letter grade is: A Enter y to continue. Enter x to quit. Client stopped
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