Last active
December 11, 2023 01:06
-
-
Save bytecodeman/dd09f0757d77088b47e4001c5b7ce09b to your computer and use it in GitHub Desktop.
Template For Java Homework and Projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Name: | |
* Date: | |
* Course Number: | |
* Course Name: | |
* Problem Number: | |
* Email: | |
* Short Description of the Problem | |
*/ | |
import java.util.Scanner; | |
public class TemplateForProjects { | |
private final static String TITLE = "CSC111 Project Template"; | |
private final static String CONTINUE_PROMPT = "Do this again? [y/N] "; | |
//********************************************** | |
// Put as many methods you need here | |
//********************************************** | |
// Start your logic coding in the process method | |
private static void process(Scanner input, String args[]) throws Exception { | |
// Following code is merely a sample, delete it | |
System.out.print("Enter value: "); | |
int x = input.nextInt(); | |
System.out.println("Processing " + x + " ..."); | |
input.nextLine(); // Clear the Keyboard | |
} | |
//********************************************** | |
// Do not change the doThisAgain method | |
private static boolean doThisAgain(Scanner input, String prompt) { | |
System.out.print(prompt); | |
String doOver = input.nextLine(); | |
return doOver.trim().equalsIgnoreCase("Y"); | |
} | |
//********************************************** | |
// Do not change the main method | |
public static void main(String args[]) throws Exception { | |
System.out.println("Welcome to " + TITLE); | |
Scanner input = new Scanner(System.in); | |
do { | |
process(input, args); | |
} while (doThisAgain(input, CONTINUE_PROMPT)); | |
input.close(); | |
System.out.println("Thank you for using " + TITLE); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment