Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.InputMismatchException;
- import java.io.IOException;
- import java.io.FileOutputStream;
- import java.util.Scanner;
- import java.util.Properties;
- public class CalculateInterestTest {
- public static void main (String [] args){
- //Variables
- Double Principal
- System.out.println("Interest Calculator by Albert Shin");
- Properties config = new Properties();
- try{
- System.out.println("Seems it's like your first time. Please insert the following variables");
- System.out.println("What is the principal? (Please enter it in a money format. Ex: 34.50");
- Scanner scan = new Scanner(System.in);
- Principal = scan.nextDouble();
- //Sets variables
- config.setProperty("database", "localhost");
- config.setProperty("dbuser", "mkyong");
- config.setProperty("dbpassword", "password");
- //Saves the properties file
- config.store(new FileOutputStream("config.properties"), null);
- } catch (IOException e){
- e.printStackTrace();
- }
- System.out.println("Please input your choice.");
- System.out.println("");
- System.out.println("1 - Simple Interest");
- System.out.println("2 - Compound Interest");
- System.out.println("3 - Get me out of here!");
- System.out.println("");
- System.out.println("Enter your choice: ");
- Scanner scan = new Scanner(System.in);
- int Choice = 0;
- boolean sucessful = false;
- try
- {
- Choice = scan.nextInt();
- sucessful = true;
- }
- catch (InputMismatchException error)
- {
- System.out.println("Invalid input!");
- }
- if (Choice == 1){
- }
- }
- private static double SimpleInterest(){
- //Variables
- Double Principal;
- System.out.println("");
- System.out.println("====================================");
- System.out.println("Welcome to the Simple Interest Menu!");
- System.out.println("====================================");
- System.out.println("");
- System.out.println("Please enter your prinicpal.");
- Scanner scan = new Scanner(System.in);
- double CalcSimpInterest
- return CalcSimpInterest;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement