IST 311 Homework Assignment 3

 

This is an individual assignment.
If you have not had Java it will take some time so don’t wait too late to start working.
Read Raposa Chapters 1 through 3.
Do problems below..
For this assignment you can use the Java SDK for the labs, as described in the book, or Eclipse.
Due at the start of class Thursday, 1/19.

 

Part 1.

Write a public class called CreditCalculator and declare the main() method within the class.
The value for currentCredits will be input from the command line.

Command-line arguments are strings so you’ll need to convert the value of currentCredits to an integer within main():
int currentCredits = Integer.parseInteger(args[0]);
* Hint Run menu:Run, then the Arguments tab
Write a method to calculate creditsNeeded given the value of currentCredits. Display the result.
Save, compile, and run your program. You’ll need to enter the command-line argument
java CreditCalculator 62

 

Part 2.

Extend the main() method in your CreditCalculator class to calculate the number of semesters remaining given 15 credits per semester.
Also, if the number of currentCredits is >= 120, output the string “You can graduate!”