From 0d41e039565870b4647af0cb860a98ece597b7dc Mon Sep 17 00:00:00 2001 From: Christopher Bohn <bohn@unl.edu> Date: Fri, 6 Sep 2024 19:36:06 -0500 Subject: [PATCH] Migrated from Coral Simulator to Java Visualizer --- Problem3.java | 14 ++++++++++++++ Problem4.java | 22 ++++++++++++++++++++++ Problem5.java | 24 ++++++++++++++++++++++++ problem3.coral | 7 ------- problem4.coral | 12 ------------ problem5.coral | 14 -------------- 6 files changed, 60 insertions(+), 33 deletions(-) create mode 100644 Problem3.java create mode 100644 Problem4.java create mode 100644 Problem5.java delete mode 100644 problem3.coral delete mode 100644 problem4.coral delete mode 100644 problem5.coral diff --git a/Problem3.java b/Problem3.java new file mode 100644 index 0000000..5487bac --- /dev/null +++ b/Problem3.java @@ -0,0 +1,14 @@ +import java.util.Scanner; + +public class Problem3 { + private static Scanner scanner = new Scanner(System.in); + public static void main(String[] args) { + float payRate; + float hoursWorked; + float grossEarnings; + payRate = scanner.nextFloat(); + hoursWorked = scanner.nextFloat(); + grossEarnings = hoursWorked * payRate; + System.out.print(grossEarnings); + } +} diff --git a/Problem4.java b/Problem4.java new file mode 100644 index 0000000..e0084ba --- /dev/null +++ b/Problem4.java @@ -0,0 +1,22 @@ +import java.util.Scanner; + +public class Problem4 { + private static Scanner scanner = new Scanner(System.in); + public static void main(String[] args) { + // Re-order lines 7-19 to solve the problem + System.out.print("A"); + System.out.print("B"); + System.out.print("C"); + System.out.print("D"); + System.out.print("F"); + float examGrade; + if (examGrade >= 90) { + } else if (examGrade >= 60) { + } else if (examGrade >= 70) { + } else if (examGrade >= 80) { + examGrade = scanner.nextFloat(); + } else { + } + // Re-order lines 7-19 to solve the problem + } +} diff --git a/Problem5.java b/Problem5.java new file mode 100644 index 0000000..3438c47 --- /dev/null +++ b/Problem5.java @@ -0,0 +1,24 @@ +import java.util.Scanner; + +public class Problem5 { + private static Scanner scanner = new Scanner(System.in); + public static void main(String[] args) { + // Re-order lines 7-21 to solve the problem + System.out.print(averageScore); + averageScore = sumOfScores / numberOfStudents; + currentStudent = 0; + currentStudent = currentStudent + 1; + currentStudentScore = scanner.nextFloat(); + float averageScore; + float currentStudentScore; + float sumOfScores; + int currentStudent; + int numberOfStudents; + numberOfStudents = scanner.nextInt(); + sumOfScores = 0; + sumOfScores = sumOfScores + currentStudentScore; + while (currentStudent < numberOfStudents) { + } + // Re-order lines 7-21 to solve the problem + } +} diff --git a/problem3.coral b/problem3.coral deleted file mode 100644 index 9a69e09..0000000 --- a/problem3.coral +++ /dev/null @@ -1,7 +0,0 @@ -float payRate -float hoursWorked -float grossEarnings -payRate = Get next input -hoursWorked = Get next input -grossEarnings = hoursWorked * payRate -Put grossEarnings to output diff --git a/problem4.coral b/problem4.coral deleted file mode 100644 index 07efea1..0000000 --- a/problem4.coral +++ /dev/null @@ -1,12 +0,0 @@ -Put "A" to output -Put "B" to output -Put "C" to output -Put "D" to output -Put "F" to output -float examGrade -if examGrade >= 90 -elseif examGrade >= 60 -elseif examGrade >= 70 -elseif examGrade >= 80 -examGrade = Get next input -else diff --git a/problem5.coral b/problem5.coral deleted file mode 100644 index 5384cfc..0000000 --- a/problem5.coral +++ /dev/null @@ -1,14 +0,0 @@ -Put averageScore to output -averageScore = sumOfScores / numberOfStudents -currentStudent = 0 -currentStudent = currentStudent + 1 -currentStudentScore = Get next input -float averageScore -float currentStudentScore -float sumOfScores -integer currentStudent -integer numberOfStudents -numberOfStudents = Get next input -sumOfScores = 0 -sumOfScores = sumOfScores + currentStudentScore -while currentStudent < numberOfStudents -- GitLab