MP3
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package mp3_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class FindHighestScore {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.print("Enter the number of students: ");
|
||||
int numOfStudents = input.nextInt();
|
||||
System.out.print("Enter a student name: ");
|
||||
String student1 = input.next();
|
||||
System.out.print("Enter a student score: ");
|
||||
double score1 = input.nextDouble();
|
||||
for (int i = 0; i < numOfStudents - 1; i++) {
|
||||
System.out.print("Enter a student name: ");
|
||||
String student = input.next();
|
||||
System.out.print("Enter a student score: ");
|
||||
double score = input.nextDouble();
|
||||
if (score > score1) {
|
||||
student1 = student;
|
||||
score1 = score;
|
||||
}
|
||||
}
|
||||
System.out.println("Top student " + student1 + "'s score is " + score1);
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package mp3_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class FindHighestScoreDoWhile {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
int i = 0;
|
||||
String student1 = "";
|
||||
double score1 = 0;
|
||||
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.print("Enter the number of students: ");
|
||||
int numOfStudents = input.nextInt();
|
||||
do {
|
||||
System.out.print("Enter a student name: ");
|
||||
String student = input.next();
|
||||
System.out.print("Enter a student score: ");
|
||||
double score = input.nextDouble();
|
||||
if (score > score1) {
|
||||
student1 = student;
|
||||
score1 = score;
|
||||
}
|
||||
i++;
|
||||
} while (i < numOfStudents);
|
||||
System.out.println("Top student " + student1 + "'s score is " + score1);
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package mp3_calebfontenot;
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class FindHighestScoreWhile {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
Scanner input = new Scanner(System.in);
|
||||
System.out.print("Enter the number of students: ");
|
||||
int numOfStudents = input.nextInt();
|
||||
System.out.print("Enter a student name: ");
|
||||
String student1 = input.next();
|
||||
System.out.print("Enter a student score: ");
|
||||
double score1 = input.nextDouble();
|
||||
while (i < numOfStudents - 1) {
|
||||
System.out.print("Enter a student name: ");
|
||||
String student = input.next();
|
||||
System.out.print("Enter a student score: ");
|
||||
double score = input.nextDouble();
|
||||
if (score > score1) {
|
||||
student1 = student;
|
||||
score1 = score;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
System.out.println("Top student " + student1 + "'s score is " + score1);
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package mp3_calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class FindTwoHighestScores {
|
||||
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
|
||||
*/
|
||||
package mp3_calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class MP3_CalebFontenot {
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// TODO code application logic here
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user