Akinyo
2012-12-06 02:03:55 UTC
public class InputTest {
public static void main(String[] args) {
Calculator calc = new Calculator();
calc.setTarrif(20);
calc.setTar1minuteChargerate(0.10);
calc.setTar1textChargerate(0.05);
Tarrif2 tar = new Tarrif2();
tar.setTarrif(35);
tar.setTar1minuteChargerate(0.10);
tar.setTar1textChargerate(0.05);
Scanner scan = new Scanner(System.in);
System.out.println("Enter tarrif number: ");
int key=scan.nextInt();
if(key==1){
System.out.println("Enter message used: ");
int enter = scan.nextInt();
System.out.println("Enter minutes used: ");
int input = scan.nextInt();
//this is the printing statement
String.format("\nTarrif:\t%s \n:Total Charge\t%s \nBreakdown(Message/Minute charges):\t%s "
,key ,calc.CalcMess(enter)+calc.calcMin(input),calc.CalcMess(enter) );
else if(key==2){
System.out.println("Enter message used: ");
int enter = scan.nextInt();
System.out.println("Enter minutes used: ");
int input = scan.nextInt();
//this is the printing section
String.format("\nTarrif:\t%s \n:Total Charge\t%s \nBreakdown(Message/Minute charges):" +
"\t%s ",key ,tar.CalcMess(enter)+tar.calcMin(input),tar.CalcMess(enter) );
}
}
}