Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript Java
import java.util.Scanner;
import java.util.Formatter;
 

public class Assingment3 {
 

    public static void main(String[] args) {
      Scanner in = new Scanner(System.in);
     final double basic = 0.025;
     final double premium = 3.5;
     final double platinum = 4.5;
      System.out.println("Welcome to CSE110 Bank:");
      System.out.println("What is your name?:");
      String name = in.next();
      System.out.println("Initial deposit into savings:");
      double savings=in.nextDouble();
      System.out.println("Initial deposit into checkings:");
      double checking=in.nextDouble();
      double total = savings+checking;
      System.out.println("Bank options:");
 
      int choice1 = in.nextInt();
      if (choice1 ==1)
      {
 
      }
      else if (choice1==2)
      {
 
      }
      else if (choice1 ==3)
      {
 
      }
      else if (choice1 == 4)
      {
 
      }
     System.out.println("your choice:  "+choice1);
      System.out.println(name+"'s "+"account balance: "+total+"(S:"+savings+"C:"+checking+")" );
      int choice2 = 4;
      switch(choice2)
              {
          case 1:
 
          case 2:
 
          case 3:
 
          case 4:
 

              }
    }
}
Posted 28-Sep-12 14:32pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You don't. Your logic will automatically fall through to the switch part of your code after any of the if/else if blocks are executed.
One thing that is odd, however, is that you have int choice2 = 4; hardcoded. I'm pretty sure that you'll want to change that.
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 28-Sep-12 21:19pm
   
Not sure OP is ready to get how to do it right, but the answer still gets 5.
--SA
Marcus Kramer at 28-Sep-12 22:09pm
   
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 28 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100