Advertisement
Guest User

errors

a guest
Mar 2nd, 2013
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.util.Calendar;
  3.  
  4. public class LEWISC002PA1
  5. {
  6. public static void main (String [] args)
  7. {
  8. Scanner scan = new Scanner (System.in);
  9.  
  10. String name;
  11. int insuredvalue;
  12. double rscale;
  13. double payout;
  14. double deductable;
  15. int total;
  16. String answer = "Y";
  17. String message;
  18.  
  19.  
  20. System.out.println("Please enter your name");
  21.  
  22. name = scan.nextLine();
  23.  
  24. while (answer.equals("Y"))
  25. {
  26. System.out.println("Please enter the insured value of your home");
  27.  
  28. insuredvalue = scan.nextInt();
  29.  
  30. System.out.println("\nRichter Scale Description\n8.0 Most structures fall\n7.0 Many buildings destroyed\n6.0 Many buildings considerably damaged, some collapse\n4.5 Damage to poorly contructed buildings\n3.5 Felt by many people, no destruction\n0 Generally not felt by people");
  31.  
  32. rscale = scan.nextDouble();
  33.  
  34. if(rscale < 0)
  35.  
  36. System.out.println("Error! Cannot enter negative value!");
  37.  
  38. if (rscale >= 8.0 && rscale >= 6.5)
  39.  
  40.  
  41. payout = .85+insuredvalue;
  42.  
  43. deductable = .15;
  44.  
  45. if (rscale <6.5 && rscale >=5.5)
  46.  
  47. payout = .75*insuredvalue;
  48.  
  49. deductable = .25*insuredvalue;
  50.  
  51.  
  52.  
  53. if (rscale <5.5 && rscale >4.5)
  54.  
  55. payout = .65*insuredvalue;
  56.  
  57. deductable = .35*insuredvalue;
  58.  
  59.  
  60.  
  61. if(rscale <=4.5 && rscale >3.5)
  62.  
  63. payout = .55*insuredvalue;
  64.  
  65. deductable = .45*insuredvalue;
  66.  
  67.  
  68.  
  69. if(rscale <3.5 && rscale >0)
  70.  
  71. payout = 0*insuredvalue;
  72.  
  73. deductable = 0*insuredvalue;
  74.  
  75.  
  76.  
  77. if(rscale == 0)
  78.  
  79. payout = 0*insuredvalue;
  80.  
  81. payout = 0*insuredvalue;
  82.  
  83.  
  84.  
  85.  
  86. System.out.println("Would you like to continue? Or end and view results? Y for yes, N for No.");
  87.  
  88. answer = scan.next().toUpperCase();
  89.  
  90. System.out.printf("PAYOUT FOR EARTHQUAKE DAMAGE\n");
  91.  
  92. System.out.printf("Home: %s\n",name);
  93.  
  94. Calendar dateTime = Calendar.getInstance();
  95.  
  96. System.out.printf ( "Date: %1$tB %1$td, %1$tY\n", dateTime );
  97.  
  98. System.out.printf ( "\nDeductable: %s\n",deductable);
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105. }
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement