In: Computer Science
Program: Java
Write a Java program using good programming principles that will
aggregate the values from several input files to calculate relevant
percentages and write the values to an output file.
You have been tasked with reading in values from multiple files
that contains different pieces of information by semester. The
Department of Education (DOE) would like the aggregate values of
performance and demographic information by academic year. A school
year begins at the fall semester and concludes at the end of the
summer semester the following year. Fall 2019 - Summer 2020 is
considered one academic year.
Input Files
These input files contain the data for three programs on
campus:
Program code 3624
Program code 5651
Program code 6635
Input file layout (all integer values) by semester:
Notes
Calculations
The following values must be calculated:
For each semester:
- the percentage of students completers (total number
of student completers / total number of students
enrolled)
For each individual program code:
- grand totals for each category (enrolled,
completers, gender, and ethnicity)
Aggregate for all semesters:
- the total number of students enrolled
- the total number of student completers
- the total number by gender
- the total number by each ethnicity
- the percentage of student completers (total
completers / total enrolled)
- the percentage of female completers (total number of
female completers / total number of female enrolled)
- the percentage of male completers
- the percentage of each ethnicity
Output
The output for this project will be two-fold. The
output will be displayed in a Message dialog box and an output
file.
The Message Dialog boxes:
Each percentage calculated should be displayed in percentage format
with one decimal place.
A sample format (the values are not accurate, this is only for formatting purposes):
Santa Fe College Academic Year 2019 - 2020 Program codes: 3624, 5651, and 6635 Aggregate total number of student enrolled: 5555 Aggregate total number of student completers: 4444 Aggregate percentage of students completing for the academic year: 81.2% Percentage of students completing Fall 2019: 76.9% Percentage of students completing Spring 2020: 85.3% Percentage of students completing Summer 2020: 84.1% |
On the next dialog screen, display the following:
Santa Fe College Academic Year 2019 - 2020 Program codes: 3624, 5651, and 6635 Aggregate values for: Female student completers: 88.8% Male student completers: 88.7% Unknown/not reported completers: 89.1% Asian completers: 90.1% Black completers: 90.2% Hispanic completers: 90.3% Multiracial completers: 90.4% Native American completers: 90.5% Native Hawaiian completers: 90.6% Unknown/Not Reported completers: 90.7% White completers: 90.8% |
Fall2019Analytics.txt: 3624 3729 2946 1774 1445 510 1442 1087 417 627 1021 939 216 47 15 122 742 572 977 735 181 39 11 84 3475651 4074 3585 1956 1977 141 1782 1731 72 413 927 893 314 56 37 395 1039 387 912 803 273 49 30 327 8046635 2116 1837 609 1058 449 582 1031 224 341 402 363 146 89 74 297 404 303 377 321 113 76 57 270 320
Spring2020Analytics.txt: 3624 3496 3102 1579 1238 679 1486 1017 599 703 1137 842 224 32 21 103 434 688 1007 774 221 30 21 101 2605651 3942 3711 1421 2213 308 2148 1349 214 443 739 804 310 46 37 173 1390 439 727 799 216 46 36 162 12866635 2101 1979 797 1273 31 752 1039 188 601 739 426 173 21 15 3 123 592 701 399 162 18 13 2 92
Summer2020Analytics.txt: 3624 2021 1983 771 1137 113 717 1083 183 307 526 601 211 27 4 13 332 297 506 600 208 26 4 13 3295651 3013 2883 1267 1393 353 1240 1297 346 226 402 373 102 16 13 17 1864 214 401 369 96 15 13 17 17586635 1731 1546 663 817 251 612 799 135 107 392 649 81 30 21 71 380 103 384 621 80 30 20 70 238
1.PROGRAMMING CODE FOR JAVA TO CALCULATE PERCENTAGES:
import java.util.Scanner; public class Percentage { public static void main(String args[]){ float percentage; float total_marks; float scored; Scanner sc = new Scanner(System.in); System.out.println("Enter your marks ::"); scored = sc.nextFloat(); System.out.println("Enter total marks ::"); total_marks = sc.nextFloat(); percentage = (float)((scored / total_marks) * 100); System.out.println("Percentage ::"+ percentage); } }
OUTPUT:
Enter your marks :: 500 Enter total marks :: 600 Percentage ::83.33333
CODE2:
// Java program to find Total Average and percentage of Five Subjects import java.util.Scanner; public class Totalof5subjects1 { private static Scanner sc; public static void main(String[] args) { int english, chemistry, computers, physics, maths; float total, Percentage, Average; sc = new Scanner(System.in); System.out.print(" Please Enter the Five Subjects Marks : "); english = sc.nextInt(); chemistry = sc.nextInt(); computers = sc.nextInt(); physics = sc.nextInt(); maths = sc.nextInt(); total = english + chemistry + computers + physics + maths; Average = total / 5; Percentage = (total / 500) * 100; System.out.println(" Total Marks = " + total); System.out.println(" Average Marks = " + Average); System.out.println(" Marks Percentage = " + Percentage); } }
3. PROGRAMMING CODE FOR SEMESTER WISE PRCENTAGES:
import
java.util.Scanner;
class
CGPA {
public
static
double
CgpaCalc(
double
[] marks,
int
n)
{
//
Variable to store the grades in
//
every subject
double
grade[] =
new
double
[n];
//
Variables to store CGPA and the
//
sum of all the grades
double
cgpa, sum =
0
;
//
Computing the grades
for
(
int
i =
0
; i < n; i++) {
grade[i]
= (marks[i] /
10
);
}
//
Computing the sum of grades
for
(
int
i =
0
; i < n; i++) {
sum
+= grade[i];
}
//
Computing the CGPA
cgpa
= sum / n;
return
cgpa;
}
// Driver
code
public
static
void
main(String
args[])
{
int
n =
5
;
double
[]
marks
=
{
90
,
80
,
70
,
80
,
90
};
double
cgpa = CgpaCalc(marks, n);
System.out.println(
"CGPA
= "
+ cgpa);
System.out.println(
"CGPA
Percentage = "
+
String.format(
"%.2f"
, cgpa *
9.5
));
}
}
HENCE I HAVE SOLVED ALL THE PROGRAMMING CODE WITH THE HEPL
OF JAVA LANGUAGE TO CALCULATE THE PERCENTAGES THAT A STUDENT HAS
GAINED AND ON THE BASIS OF THAT GRADES ARE ALSO SHOWN.DIFFRENTS
METHODS IN JAVA I HAVE PUBLISHED FROM THE BEGINNERS TO GAIN
KNOWLEDGE ABOUT THA BASICS OF JAVA AND HOW TO CALCULATE SEMESTER
WISE PERCENTAGES IN JAVA.HOPE YOU LIKE IT AND ENJOY MY CODES.GOOD
LUCK BUDDIES.ALL THE BEST..