mirror of
https://github.com/RustyRaptor/Programs.git
synced 2026-12-03 15:45:21 -07:00
adjusting theming; code format and organize imports
This commit is contained in:
1 parent
65d1c94dc6
commit
011b260320
2 files changed
+145
-131
No files matched your search
@@ -1,71 +1,74 @@
|
||||
package edu.nmsu.cs.scoring;
|
||||
|
||||
/***
|
||||
* Olympic Igloo Scoring Class
|
||||
*
|
||||
* For the Winter Olympics igloo building event there are
|
||||
* three judges, each of which gives a score from 0 to 50
|
||||
* (inclusive), but the lowest score is thrown out and the
|
||||
* competitor's overall score is just the sum of the two
|
||||
* highest scores. This class supports the recording of the
|
||||
* three judge's scores, and the computing of the competitor's
|
||||
* overall score.
|
||||
*
|
||||
***/
|
||||
* Olympic Dragon Racing Scoring Class
|
||||
*
|
||||
* For the Summer Olympics dragon racing event there are three judges, each of which gives a score
|
||||
* from 0 to 50 (inclusive), but the lowest score is thrown out and the competitor's overall score
|
||||
* is just the sum of the two highest scores. This class supports the recording of the three judge's
|
||||
* scores, and the computing of the competitor's overall score.
|
||||
*
|
||||
***/
|
||||
|
||||
public class IglooScore1
|
||||
public class RacingScore1
|
||||
{
|
||||
|
||||
int score1;
|
||||
int score2;
|
||||
int score3;
|
||||
int score1;
|
||||
|
||||
public IglooScore1()
|
||||
{
|
||||
score1 = 0;
|
||||
score2 = 0;
|
||||
score3 = 0;
|
||||
}
|
||||
int score2;
|
||||
|
||||
public void recordScores(int s1, int s2, int s3)
|
||||
{
|
||||
score1 = s1;
|
||||
score2 = s2;
|
||||
score3 = s3;
|
||||
}
|
||||
int score3;
|
||||
|
||||
public int overallScore()
|
||||
{
|
||||
int s;
|
||||
if (score1 < score2)
|
||||
s = score2;
|
||||
else
|
||||
s = score1;
|
||||
if (s > score3)
|
||||
s = score3;
|
||||
s = (score1+score2+score3) - s;
|
||||
return s;
|
||||
}
|
||||
public RacingScore1()
|
||||
{
|
||||
score1 = 0;
|
||||
score2 = 0;
|
||||
score3 = 0;
|
||||
}
|
||||
|
||||
public static void main(String args[])
|
||||
{
|
||||
int s1, s2, s3;
|
||||
if (args.length != 3) {
|
||||
System.err.println("Error: must supply three arguments!");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
s1 = Integer.parseInt(args[0]);
|
||||
s2 = Integer.parseInt(args[1]);
|
||||
s3 = Integer.parseInt(args[2]);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error: arguments must be integers!");
|
||||
return;
|
||||
}
|
||||
IglooScore1 score = new IglooScore1();
|
||||
score.recordScores(s1,s2,s3);
|
||||
System.out.println("Overall score: " + score.overallScore());
|
||||
return;
|
||||
}
|
||||
public void recordScores(int s1, int s2, int s3)
|
||||
{
|
||||
score1 = s1;
|
||||
score2 = s2;
|
||||
score3 = s3;
|
||||
}
|
||||
|
||||
public int overallScore()
|
||||
{
|
||||
int s;
|
||||
if (score1 < score2)
|
||||
s = score2;
|
||||
else
|
||||
s = score1;
|
||||
if (s > score3)
|
||||
s = score3;
|
||||
s = (score1 + score2 + score3) - s;
|
||||
return s;
|
||||
}
|
||||
|
||||
public static void main(String args[])
|
||||
{
|
||||
int s1, s2, s3;
|
||||
if (args.length != 3)
|
||||
{
|
||||
System.err.println("Error: must supply three arguments!");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
s1 = Integer.parseInt(args[0]);
|
||||
s2 = Integer.parseInt(args[1]);
|
||||
s3 = Integer.parseInt(args[2]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("Error: arguments must be integers!");
|
||||
return;
|
||||
}
|
||||
RacingScore1 score = new RacingScore1();
|
||||
score.recordScores(s1, s2, s3);
|
||||
System.out.println("Overall score: " + score.overallScore());
|
||||
return;
|
||||
}
|
||||
|
||||
} // end class
|
||||
|
||||
@@ -1,82 +1,93 @@
|
||||
package edu.nmsu.cs.scoring;
|
||||
|
||||
/***
|
||||
* Olympic Igloo Scoring Class
|
||||
*
|
||||
* For the Winter Olympics igloo building event there are
|
||||
* three judges, each of which gives a score from 0 to 50
|
||||
* (inclusive), but the lowest score is thrown out and the
|
||||
* competitor's overall score is just the sum of the two
|
||||
* highest scores. This class supports the recording of the
|
||||
* three judge's scores, and the computing of the competitor's
|
||||
* overall score.
|
||||
*
|
||||
***/
|
||||
* Olympic Dragon Racing Scoring Class
|
||||
*
|
||||
* For the Summer Olympics dragon racing event there are three judges, each of which gives a score
|
||||
* from 0 to 50 (inclusive), but the lowest score is thrown out and the competitor's overall score
|
||||
* is just the sum of the two highest scores. This class supports the recording of the three judge's
|
||||
* scores, and the computing of the competitor's overall score.
|
||||
*
|
||||
***/
|
||||
|
||||
public class IglooScore2
|
||||
public class RacingScore2
|
||||
{
|
||||
|
||||
int score1;
|
||||
int score2;
|
||||
int score3;
|
||||
int score1;
|
||||
|
||||
public IglooScore2()
|
||||
{
|
||||
score1 = 0;
|
||||
score2 = 0;
|
||||
score3 = 0;
|
||||
}
|
||||
int score2;
|
||||
|
||||
public void recordScores(int s1, int s2, int s3)
|
||||
{
|
||||
score1 = s1;
|
||||
score2 = s2;
|
||||
score3 = s3;
|
||||
}
|
||||
int score3;
|
||||
|
||||
public int overallScore()
|
||||
{
|
||||
int s, s1, s2;
|
||||
if (score1 < score2 && score1 < score3) {
|
||||
s1 = score2;
|
||||
s2 = score3;
|
||||
} else if (score2 < score1 && score2 < score3) {
|
||||
s1 = score1;
|
||||
s2 = score2;
|
||||
} else if (score3 < score1 && score3 < score2) {
|
||||
s1 = score1;
|
||||
s2 = score2;
|
||||
} else {
|
||||
s1 = 99;
|
||||
s2 = 99;
|
||||
}
|
||||
s = s1 + s2;
|
||||
return s;
|
||||
}
|
||||
public RacingScore2()
|
||||
{
|
||||
score1 = 0;
|
||||
score2 = 0;
|
||||
score3 = 0;
|
||||
}
|
||||
|
||||
public static void main(String args[])
|
||||
{
|
||||
int s1, s2, s3;
|
||||
if (args==null || args.length != 3) {
|
||||
System.err.println("Error: must supply three arguments!");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
s1 = Integer.parseInt(args[0]);
|
||||
s2 = Integer.parseInt(args[1]);
|
||||
s3 = Integer.parseInt(args[2]);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error: arguments must be integers!");
|
||||
return;
|
||||
}
|
||||
if (s1<0 || s1>50 || s2<0 || s2>50 || s3<0 || s3>50) {
|
||||
System.err.println("Error: scores must be between 0 and 50!");
|
||||
return;
|
||||
}
|
||||
IglooScore2 score = new IglooScore2();
|
||||
score.recordScores(s1,s2,s3);
|
||||
System.out.println("Overall score: " + score.overallScore());
|
||||
return;
|
||||
}
|
||||
public void recordScores(int s1, int s2, int s3)
|
||||
{
|
||||
score1 = s1;
|
||||
score2 = s2;
|
||||
score3 = s3;
|
||||
}
|
||||
|
||||
public int overallScore()
|
||||
{
|
||||
int s, s1, s2;
|
||||
if (score1 < score2 && score1 < score3)
|
||||
{
|
||||
s1 = score2;
|
||||
s2 = score3;
|
||||
}
|
||||
else if (score2 < score1 && score2 < score3)
|
||||
{
|
||||
s1 = score1;
|
||||
s2 = score2;
|
||||
}
|
||||
else if (score3 < score1 && score3 < score2)
|
||||
{
|
||||
s1 = score1;
|
||||
s2 = score2;
|
||||
}
|
||||
else
|
||||
{
|
||||
s1 = 99;
|
||||
s2 = 99;
|
||||
}
|
||||
s = s1 + s2;
|
||||
return s;
|
||||
}
|
||||
|
||||
public static void main(String args[])
|
||||
{
|
||||
int s1, s2, s3;
|
||||
if (args == null || args.length != 3)
|
||||
{
|
||||
System.err.println("Error: must supply three arguments!");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
s1 = Integer.parseInt(args[0]);
|
||||
s2 = Integer.parseInt(args[1]);
|
||||
s3 = Integer.parseInt(args[2]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.err.println("Error: arguments must be integers!");
|
||||
return;
|
||||
}
|
||||
if (s1 < 0 || s1 > 50 || s2 < 0 || s2 > 50 || s3 < 0 || s3 > 50)
|
||||
{
|
||||
System.err.println("Error: scores must be between 0 and 50!");
|
||||
return;
|
||||
}
|
||||
RacingScore2 score = new RacingScore2();
|
||||
score.recordScores(s1, s2, s3);
|
||||
System.out.println("Overall score: " + score.overallScore());
|
||||
return;
|
||||
}
|
||||
|
||||
} // end class
|
||||
|
||||
Reference in new issue
Block a user