Sun Apr 15, 2012 11:56 am
import java.io.*;
//**************************************** Base Class(Customer) ****************************************
abstract class Customer // Base Class is Customer
{
char name1, id1;
Customer(char a, char b)
{
name1 = a;
id1 = b;
System.out.println("\t Enter your nama : "+a);
System.out.println("\t Enter your ID : "+b);
}
char item1, item2, item3, item4, item5;
double amount1;
Customer(char c, char d, char e, char f, char g, double h )
{
item1 = c;
item2 = d;
item3 = e;
item4 = f;
item5 = g;
amount1 = h;
}
abstract void setItem1();
abstract void setItem2();
abstract void setItem3();
abstract void setItem4();
abstract void setItem5();
}
//**************************************** Derived Class (Cash) ****************************************
class Cash extends Customer // Derived Class for Cash
{
Cash(char c, char d, char e, char f, char g)
{
super(c, d, e, f, g);
}
void setItem1()
{
System.out.println("***************************************************+\n");
System.out.println("|\t Enter your Item Purchased : "+item1+"\t |"); // This is a Item 1
System.out.println("***************************************************+\n");
}
void setItem2()
{
System.out.println("***************************************************+\n");
System.out.println("|\t Enter your Item Purchased : "+item2+"\t |"); // This is a Item 2
System.out.println("***************************************************+\n");
}
void setItem3()
{
System.out.println("***************************************************+\n");
System.out.println("|\t Enter your Item Purchased : "+item3+"\t |"); // This is a Item 3
System.out.println("***************************************************+\n");
}
void setItem4()
{
System.out.println("***************************************************+\n");
System.out.println("|\t Enter your Item Purchased : "+item4+"\t |"); // This is a Item 4
System.out.println("***************************************************+\n");
}
void setItem5()
{
System.out.println("***************************************************+\n");
System.out.println("|\t Enter your Item Purchased : "+item5+"\t |"); // This is a Item 5
System.out.println("***************************************************+\n");
}
}
//**************************************** Derived Class (Card) ****************************************
class Card extends Customer // Derived Class for Card
{
Card(char c, char d, char e, char f, char g)
{
super(c, d, e, f, g);
}
void setItem1()
{
System.out.println("***************************************************+\n");
System.out.println("|\t Enter your Item Purchased : "+item1+"\t |"); // This is a Item 1
System.out.println("***************************************************+\n");
}
void setItem2()
{
System.out.println("***************************************************+\n");
System.out.println("|\t Enter your Item Purchased : "+item2+"\t |"); // This is a Item 2
System.out.println("***************************************************+\n");
}
void setItem3()
{
System.out.println("***************************************************+\n");
System.out.println("|\t Enter your Item Purchased : "+item3+"\t |"); // This is a Item 3
System.out.println("***************************************************+\n");
}
void setItem4()
{
System.out.println("***************************************************+\n");
System.out.println("|\t Enter your Item Purchased : "+item4+"\t |"); // This is a Item 4
System.out.println("***************************************************+\n");
}
void setItem5()
{
System.out.println("***************************************************+\n");
System.out.println("|\t Enter your Item Purchased : "+item5+"\t |"); // This is a Item 5
System.out.println("***************************************************+\n");
}
}
// ********************************************* Permulaan *********************************************
public class Customer
{
public static void main (String [] args)throws IOException
{
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
Scanner stdIn = new Scanner(System.in);
char nama;
char id;
// char number,nak;
Date d=new Date();
SimpleDateFormat df=new SimpleDateFormat("dd/MM/yyyy");
System.out.println("\n\n*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*"); System.out.println("\n\n\t\t POLITEKNIK SEBERANG PERAI");
System.out.println("\t JABATAN TEKNOLOGI MAKLUMAT & KOMUNIKASI");
System.out.println("\t\t F4229 - JAVA PROGRAMMING 1");
System.out.println("\n\t\t MINI PROJECT");
System.out.println("\t\t T I T L E : F . I . A C O M P A N Y ");
System.out.println("\n\n*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*");
System.out.println(" *--------------*-------------------------------*--------------*");
System.out.println(" | NAME\t\t| SITI SYAFIQAH BINTI ZUKIFLI\t\t| 10DIP09F2052 |");
System.out.println(" |\t\t| NURUL AIN BINTI KASERI \t| 10DIP09F2053 |");
System.out.println(" |\t\t| NOR FATIN SHUHAIDA BINTI ABDULGHANI\t| 10DIP09F2057|");
System.out.println(" *--------------*-------------------------------*--------------*");
System.out.println(" | CLASS\t\t| DIP5B\t\t\t\t\t |");
System.out.println(" *--------------*----------------------------------------------*");
System.out.println(" | Date\t\t| "+df.format(d)+"\t\t\t |");
System.out.println(" *--------------*----------------------------------------------*");
System.out.println(" | LECTURER NAME | PUAN PAZILAH BINTI DARUS\t\t |");
System.out.println(" *--------------*----------------------------------------------*\n");
slow(); // Paparan WELCOME TO F . I . A C O M P A N Y
for( int i=1; i<4; i++ )
{
garis();
System.out.print("*+*+*+*+*+*+*+");
}
garis();
System.out.print("Welcome");
garis();
System.out.print(" to");
garis();
System.out.print(" F . I . A "); //
garis();
System.out.print(" C O M P A N Y");
// garis();
// System.out.print(" SHOP");
for( int i=1; i<4; i++ )
{
garis();
System.out.print("*+*+*+*+*+*+*+");
}
System.out.println("\n\n \t Enter your information");
}
}
//*********************************************** NO 1 ***********************************************
class CustomerCash
{
public static void main(String args[])
{
int sum, discount, amount1, amount2, amount3, amount4, amount5;
sum = amount1 + amount2 + amount3 + amount4 + amount5;
discount = sum * 5 / 100;
if(amount1>150)
{
System.out.println("\t Your purchase above RM 150.00, you are entitled to a discount of 5% ");
System.out.println("\t Your Discount is : "+discount);
}
else(amount<150)
// System.out.println("Start: "+df.format(d)+" --> " + df.format(new Date(d.getTime() + 7 * 24 * 60 * 60 * 1000)));
}
}
Sat May 12, 2012 11:07 pm
int sum, discount, amount1, amount2, amount3, amount4, amount5;
sum = amount1 + amount2 + amount3 + amount4 + amount5;
discount = sum * 5 / 100;
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.