thanks
- Code: Select all
import java.util.InputMismatchException;
import java.util.Scanner;
public class savingsAccount
{
void display()
{
Scanner input = new Scanner(System.in);
boolean continueloop = true;
do
{
try
{
System.out.println(" enter name ");
String name = input.next();
System.out.println(" year of study .");
int year = input.nextInt();
System.out.println(" enter faculty ");
String faculty = input.next();
System.out.println(" enter course ");
String course = input.next();
System.out.println(" enter university ");
String university = input.next();
System.out.println(" enter telephone no .");
int telephone = input.nextInt();
System.out.println(" enter email address ");
String emailAddress = input.next();
System.out.println(" enter physical address ");
String paddress = input.next();
System.out.println("");
// continueloop = false;
System.out.println(" thanks for creating an account");
System.out.println("");
System.out.println(" enter deposit");
double savings =0;
double deposit = input.nextInt();
//System.out.println("do you want to check yo balance");
savings=savings+deposit;
System.out.println("");
System.out.println(" your savings is "+ savings );
System.out.println("");
System.out.println(" do you want to withdraw " );
System.out.println("");
System.out.println(" enter amount you want to withdraw ");
int withdraw = input.nextInt();
double withdrawal=savings -withdraw;
System.out.println(" you have withdrawn"+" " + withdraw +" "+" shillings "+" "+"and your balance is"+ " " +withdrawal);
System.out.println("");
System.out.println("");
continueloop = false;
}
catch (InputMismatchException inputMismatchException)
{
System.err.printf("\nException: %s\n", inputMismatchException);
input.nextLine();
System.out.println(" ");
System.out.println(" you must enter correct datatype . pliz try again \n");
}
`
} while ( continueloop);
}
}
this code implements the above one
class createSavingsAccount
{
public static void main(String [] args){
savingsAccount student= new savingsAccount();
student.display();
}
}
thanks for any help rendered

