import java.util.Arrays;
public class Challenge042
{
public static void main(String[] args)
{
int[] scores = {97,56,78,88};
Arrays.sort(scores);
System.out.println("Original Scores:");
for(int x = 0; x <= scores.length - 1; x++)
{
System.out.println(scores[x]);
}
System.out.println();
curveScores(scores);
}
public static void curveScores(int[] s)
{
int[] sortedScores = s;
Arrays.sort(sortedScores);
int curve = 100 - sortedScores[sortedScores.length - 1];
System.out.println("Curved Scores:");
for(int x = 0; x <= s.length - 1; x++)
{
System.out.println((s[x] + curve));
}
}
}
public class Challenge042
{
public static void main(String[] args)
{
int[] scores = {97,56,78,88};
Arrays.sort(scores);
System.out.println("Original Scores:");
for(int x = 0; x <= scores.length - 1; x++)
{
System.out.println(scores[x]);
}
System.out.println();
curveScores(scores);
}
public static void curveScores(int[] s)
{
int[] sortedScores = s;
Arrays.sort(sortedScores);
int curve = 100 - sortedScores[sortedScores.length - 1];
System.out.println("Curved Scores:");
for(int x = 0; x <= s.length - 1; x++)
{
System.out.println((s[x] + curve));
}
}
}
−Phoenix
Effective approach involving the Arrays class from the util library, good work. 600 XPs awarded for this completion.
ReplyDelete