Introducing JOptionPane.
The Learning Goal for this exercise is to interact with a user with JOptionPane and use that instead of Scanner for user input and output.
PowerShell or Terminal is not a standard way that users interact with programs. Windows and dialog boxes are very natural. JOptionPane will allow you to get information to and from a user.
Create a Calculator that will calculate the grade in this course.
_Create a Java Program that can calculate your final grade based on:
_Attendance 10% (In order to receive any attendance credit, you must earn at least 6 of the 10 points.), Weekly quizzes 10%, weekly class assignments 10%, lab 10%, project1 20%,project 2 20%, homework 40% ...The grading scale expected to be used is: A >= 90% > B >= 80% > C >= 70% > D >= 60% > F... Late work will receive a 30% reduction.
_Use a dialog box to welcome the user and tell them what the program does.
_For Attendance, enter the points earned, from 0-13, but follow the rules for no points if less than 6 points are earned.
_For gather quizzes, use the average of the quizzes from 0-10
_For all other categories, use a 0-100 scale for the total grade in that category (not individual grades) and then weight it just as described in the syllabus.
_Each click of OK will enter the grade being asked for and move to the next grade.
_When asking for a grade, include what the grade is for and then give the expected range as an example.
_After all grades are entered, display the numeric grade with 2 decimal places. example 92.54 and the letter grade earned.
_Accept user input and display output through JOptionPanes - do not use System.out.print...
_Use the javac command to compile your code.
_Use the java command to evaluate the results of your code.
There seems to be a problem with the percentage in the given problem (all the percentages add to 110%).
But, the solution in java source code is given below:-
//----------------------------------------------------------------------------------------------------------------------------------------------
import java.lang.*;
import javax.swing.JOptionPane;
public final class Grades
{
public static void main(String[]args)
{
int reply=0; // this variable
stores whether the submission was late
int attd = 0; // the attendance
points (from 0 to 13)
int quiz = 0; // the average points
for quizzes (from 0 to 10)
float assign = 0; // the average
marks for assignments (from 0 to 100)
float lab = 0; // the average marks
for laboratory experiments (from 0 to 100)
float proj1 = 0; // the average
marks for first project (from 0 to 100)
float proj2 = 0; // the average
marks for second project (from 0 to 100)
float homew = 0; // the average
marks for homework (from 0 to 100)
float marks=0; // total marks
char grade='X'; // overall
grade
// Welcome the user and display
what the program does
JOptionPane.showMessageDialog(null,"Welcome!\n This program various
marks & points as input\n and then displays overall marks and
grade.");
// taking inputs
attd =
Integer.parseInt(JOptionPane.showInputDialog("Enter
Attendance(0-13):-"));
quiz =
Integer.parseInt(JOptionPane.showInputDialog("Enter Average of
Quizzes(0-10):-"));
assign =
Float.parseFloat(JOptionPane.showInputDialog("Enter the Percentage
of Assignments:-"));
lab = Float.parseFloat(JOptionPane.showInputDialog("Enter the
Percentage of Marks in Laboratory:-"));
proj1 =
Float.parseFloat(JOptionPane.showInputDialog("Enter the Percentage
of First Project:-"));
proj2 =
Float.parseFloat(JOptionPane.showInputDialog("Enter the Percentage
of Second Project:-"));
homew =
Float.parseFloat(JOptionPane.showInputDialog("Enter the Percentage
of Homeworks:-"));
reply =
JOptionPane.showConfirmDialog(null,"Was any of the Submission
late?", "LateSubmission", JOptionPane.YES_NO_OPTION);
// the calculations of total marks
is below:-
if(attd>=6) // attendance points
are only awarded if there are more than 6 points
marks +=
attd*(10/13); // 10% of attendance
marks += quiz; // 10% of quiz
marks += assign*0.1; // 10% of
assignments
marks += lab*0.1; // 10% of
lab
marks += proj1*0.2; // 20% of first
project
marks += proj2*0.2; // 20% of
second project
marks += homew*0.4; // 40% of home
work
if(reply == JOptionPane.YES_OPTION)
// if the submission was late
{
marks -=
30;
}
// assigning a grade
if(marks>=90)
{
grade =
'A';
}
else if(marks>=80)
{
grade =
'B';
}
else if(marks>=70)
{
grade =
'C';
}
else if(marks>=60)
{
grade =
'D';
}
else
{
grade =
'F';
}
// showing output
JOptionPane.showMessageDialog(null,"Total Marks: "+marks+" %\nTotal
Grade: "+grade);
}
}
//------------------------------------------------------------------------------------------------------------------------------------
// To compile this class simply save it with filename 'Grades.java'.
// Then change the directory to the location of the source file.
// Then type:-
// javac Grades.java
//---------------------------------------------------------------------------------------------------------------------------------------
// To run this program type:-
// java Grades
Introducing JOptionPane. The Learning Goal for this exercise is to interact with a user with JOptionPane...
Visual Basic (VB) Code on Visual Studio Code a Visual Basic (VB) program that calculates the final grade a school course. The program will ask the user to enter ten grades for assignments (each is out of 25), five grades for quizzes (each out of 30), a midterm grade out of 300, extra-credit final project points (out of 100), final test points (out of 300) The program will add all of the points you entered and show you a letter...
Open the Chang Solution (Chang Solution.sln) file contained in the VbReloaded2015\ Chap11\Chang Solution folder. The application should display a grade based on the number of points entered by the user. The grading scale is shown in Figure 11-47. Create a structure that contains two members: an Integer variable for the minimum points and a String variable for the grades. Use the structure to declare a class-level one-dimensional array that has five elements. The MainForm_Load procedure should store the minimum points...
Java programming only Create a Java program that inputs a grade from the user. The grade input from the user will be an integer. Once the input is stored, use an if-else-if block of code to determine the letter grade of the inputted integer grade. Do not use a bunch of if statements by themselves to solve this problem. You will print an error message for inputs greater than 100 and for inputs less than 0. Both errors must be...
C programming. Write the code described in the picture with given 2 example executions of the code, and they must match. AND YOU CANT USE if statements! Problem: Allow the user to enter a positive integer value to represent the seed value for the random number generator. Next, generate a random integer that represents a possible number of points that a student may earn in a given class (0 to a maximum of 1000 possible points). Calculate the corresponding letter...
Homework 3: Input Validation 1 Objectives control structures console-based user input using Scanner class writing complete programs using two classes: client and supplier 2 User Interface Specification This is a console-based I/O program. Display should go to System.out (print or println) and the program will get user input using the Scanner class. The flow of execution should be as follows: When the program starts, display a one-line introduction to the user Display a menu with 5 options 1. validate zip...
Project 4: Month-end Sales Report with array and validation Input dialog box for initial user prompt with good data and after invalid data Input OK Cancel Input dialog boxes with sample input for Property 1 Ingut X Input Enter the address for Property 1 Enter the value of Property 1: OK Cancel Input dialog boxes after invalid data entered for Property 1 Error Please enter anmumber greater than D Ester the walue of Peoperty t Console output END SALES REPORT...
Java Programing Code only Ragged Array Assignment Outcome: Student will demonstrate the ability to create and use a 2D array Student will demonstrate the ability to create and use a jagged array Student will demonstrate the ability to design a menu system Student will demonstrate the ability to think Program Specifications: Write a program that does the following: Uses a menu system Creates an array with less than 25 rows and greater than 5 rows and an unknown number of...
using java Program: Please read the complete prompt before going into coding. Write a program that handles the gradebook for the instructor. You must use a 2D array when storing the gradebook. The student ID as well as all grades should be of type int. To make the test process easy, generate the grade with random numbers. For this purpose, create a method that asks the user to enter how many students there are in the classroom. Then, in each...
/** * File: GradeCalculator . java * Description: Instances of this class are used to calculate * a course average and a letter grade. In order to calculate * the average and the letter grade, a GradeCalculator must store * two essential pieces of data: the number of grades and the sum * of the grades. Therefore these are declared as object properties * (instance variables). * Each time calcAverage (grade) is called, a new grade is added to *...
In C++ Assignment 8 - Test Scores Be sure to read through Chapter 10 before starting this assignment. Your job is to write a program to process test scores for a class. Input Data You will input a test grade (integer value) for each student in a class. Validation Tests are graded on a 100 point scale with a 5 point bonus question. So a valid grade should be 0 through 105, inclusive. Processing Your program should work for any...