Monday, July 13, 2009

bicycle loans

import java.util.*;
import java.text.*;
public class ProjectStartMod
{
static char choice=' ';
static char bchoice=' ';
static boolean loop=true;
static String[] name=new String[10];
static String[] no=new String[10];
static int[] type=new int[10];
static int bck=2;
static int bca=3;
static int bcm=5;
static int bcp;
static int[] lct=new int[10];
static int nh=0;
static int dp=10;
static int[] hr=new int[10];
static Scanner input=new Scanner(System.in).useDelimiter("\r\n");

public static void main(String[] args) throws Exception
{
do
{
System.out.println(" Bicycle Loan Menu ");
System.out.println(" ================= ");
System.out.println("1. select 1 Enter(Name, Bic(No), Bic(Type),Loan(Hr)");
System.out.println("2. select 2 List all loans and end the day Collection");
System.out.println("Q. choice Q Quit");
System.out.print("Please enter your choice (1, 2 or Q: ");
choice=(char) System.in.read();
System.in.read();
System.in.read();

switch(choice)
{
case '1' : for (int i=0; i<2; i++)

{
System.out.print(" Enter Name : ");
name[i]=input.next();
System.out.print(" Enter Bicycle Number : ");
no[i]=input.next();
System.out.print(" Enter Bicycle Type [1 for Kid], [2 for Adult], [3 for Mountain]: ");

bchoice=(char) System.in.read();
System.in.read();
System.in.read();


switch(bchoice)
{
case '1' :
bcp=2;

break;

case '2' :
bcp=3;

break;

case '3' :
bcp=5;

break;

default : System.out.println("Please enter correctly!!");
System.out.println("");
}


System.out.print(" Enter loan period in hr : ");
hr[i]=input.nextInt();
lct[i]=(bcp*hr[i]);
System.out.println("Mr/Ms "+name[i]+", please pay $"+lct[i]+" and $"+dp+" for deposit");
System.out.println("");

}
break;

case '2' : char choice='x';

for (int i=0; i<2; i++)
{
System.out.println("\t "+name[i]+"\t"+no[i]+"\t"+bcp+"\t"+nh);
System.out.println("\t "+lct[i]+"\t "+bcp);
}
break;

case 'Q' :
case 'q' : loop=false;
break;

default : System.out.println("Please enter correctly!!");
System.out.println("");
}//end switch
}while(loop);
}//end main()
}//end of class

No comments:

Post a Comment

Rip368.blogspot.com