Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. import java.util.InputMismatchException;
  2. import java.io.IOException;
  3. import java.io.FileOutputStream;
  4. import java.util.Scanner;
  5. import java.util.Properties;
  6.  
  7. public class CalculateInterestTest {
  8. public static void main (String [] args){
  9. //Variables
  10. Double Principal
  11. System.out.println("Interest Calculator by Albert Shin");
  12. Properties config = new Properties();
  13.  
  14. try{
  15. System.out.println("Seems it's like your first time. Please insert the following variables");
  16. System.out.println("What is the principal? (Please enter it in a money format. Ex: 34.50");
  17. Scanner scan = new Scanner(System.in);
  18. Principal = scan.nextDouble();
  19. //Sets variables
  20. config.setProperty("database", "localhost");
  21. config.setProperty("dbuser", "mkyong");
  22. config.setProperty("dbpassword", "password");
  23. //Saves the properties file
  24. config.store(new FileOutputStream("config.properties"), null);
  25. } catch (IOException e){
  26. e.printStackTrace();
  27.  
  28. }
  29. System.out.println("Please input your choice.");
  30. System.out.println("");
  31. System.out.println("1 - Simple Interest");
  32. System.out.println("2 - Compound Interest");
  33. System.out.println("3 - Get me out of here!");
  34. System.out.println("");
  35. System.out.println("Enter your choice: ");
  36.  
  37. Scanner scan = new Scanner(System.in);
  38. int Choice = 0;
  39. boolean sucessful = false;
  40. try
  41. {
  42. Choice = scan.nextInt();
  43. sucessful = true;
  44. }
  45. catch (InputMismatchException error)
  46. {
  47. System.out.println("Invalid input!");
  48. }
  49.  
  50. if (Choice == 1){
  51.  
  52. }
  53. }
  54.  
  55. private static double SimpleInterest(){
  56. //Variables
  57. Double Principal;
  58. System.out.println("");
  59. System.out.println("====================================");
  60. System.out.println("Welcome to the Simple Interest Menu!");
  61. System.out.println("====================================");
  62. System.out.println("");
  63. System.out.println("Please enter your prinicpal.");
  64. Scanner scan = new Scanner(System.in);
  65. double CalcSimpInterest
  66. return CalcSimpInterest;
  67.  
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement