3 Replies - 360 Views - Last Post: 06 May 2009 - 07:37 PM Rate Topic: -----

#1 Awing85  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 18-April 09

What character that suitable use for date in program

Posted 06 May 2009 - 05:56 AM

This is my program

import java.io.*;

class PeminjamanBuku
{
	String nama_pelajar, no_pendaftaran, jabatan,  kelas ,kad_pengenalan, tajuk_buku, no_siri, str;
	int  tempohP, tarikhPeminjaman, tarikhPemulangan;  
	double denda=0;
	
	
	public String menuList()throws IOException
	{
		String choice;
		
		BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
		
		System.out.println("\n	============================================================="); 
		System.out.println("\n	SELAMAT DATANG KE SISTEM PEMINJAMAN BUKU DI PERPUSTAKAAN PMU"); 
		System.out.println("\n\t\t	1. MAKLUMAT PELAJAR");
		System.out.println("\n\t\t	2. MAKLUMAT BUKU ");
		System.out.println("\n\t\t	3. PAPARAN MAKLUMAT");
		System.out.println("\n\t\t	4. KELUAR SISTEM");
		System.out.println("\n	============================================================="); 
			
		System.out.print("\n\n\n	SILA MASUKKAN PILIHAN ANDA : ");
		
		choice=stdin.readLine();
		int num=Integer.parseInt(choice);
		
		return choice;
	}

	public void selectionCase(String selection)throws IOException
	{
		String choice;
		int num=Integer.parseInt(selection);
		
		
		switch(num)
		{
			case 1	:	Maklumat_Pelajar();
						choice=menuList();
						selectionCase(choice);
						break;
			
			case 2	:	Maklumat_Buku();
						choice=menuList();
						selectionCase(choice);
						break;
						
			case 3	:	Papar_Maklumat();
						choice=menuList();
						selectionCase(choice);
						break;
			
			case 4	:	System.exit(0);
		}
	}
	
	public void  Maklumat_Pelajar() throws IOException
	{
		BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
		
		System.out.println("\n\n\n");
		System.out.println("\n\t\t\t1. MAKLUMAT PELAJAR");
		System.out.print("\n\t************************************************************\n\n");
		System.out.print("\n\tMasukkan Nama Pelajar : ");
		nama_pelajar=stdin.readLine();
		
		System.out.print("\n\tMasukkan No Kad Pengenalan Pelajar : ");
		kad_pengenalan=stdin.readLine();
		
		System.out.print("\n\tMasukkan No Pendaftaran Pelajar : ");
		no_pendaftaran=stdin.readLine();

		System.out.print("\n\tMasukkan Kod Jabatan : ");
		jabatan=stdin.readLine();
	
		System.out.print("\n\tMasukkan Kelas Pelajar : ");
		kelas=stdin.readLine();
		
		System.out.print("\n\n\n");
	}
	
	public void  Maklumat_Buku() throws IOException
	{
		BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
		
		System.out.println("\n\n\n");
		System.out.println("\n\t\t\t2. MAKLUMAT BUKU");
		System.out.print("\n\t**************************************************************\n\n");
		System.out.print("\n\tMasukkan Tajuk Buku : ");
		tajuk_buku=stdin.readLine();
	
		System.out.print("\n\tMasukkan Nombor Siri Buku  : ");
		no_siri=stdin.readLine();
	
		System.out.print("\n\tMasukkan Tarikh Peminjaman Buku  : ");
		str=stdin.readLine();
		tarikhPeminjaman=Integer.parseInt(str);
	
		System.out.print("\n\tMasukkan Tarikh Pemulangan Buku : ");
		str=stdin.readLine();
		tarikhPemulangan=Integer.parseInt(str);
		
		System.out.print("\n\n");
	
		tempohP = tarikhPemulangan - tarikhPeminjaman;
		
		denda=(tempohP*5.00)-(7*5.00);
		
		if(tempohP>=7)
		{
			System.out.println("\n\tAnda Dikenakan Denda Kerana Lambat Memulangkan Buku Yang Dipinjam : "+denda);
		}
		
		else
		{
			System.out.println("\n\tTerima Kasih, Jumpa Lagi!!!");
			System.out.print("\n\n\n");
			
		}
		
	}
	
	public void Papar_Maklumat()
	{
	
		System.out.print("\n\n\n");
		
		System.out.println("\n\t *************************************************************");
		
		System.out.print("\n\n\t1. PAPARAN MAKLUMAT PELAJAR\n\n");
		
		System.out.print("\n\t Nama Pelajar :  "+nama_pelajar);
		
		System.out.print("\n\t No Kad Pengenalan Pelajar :  "+kad_pengenalan);
		
		System.out.print("\n\t No Pendaftaran Pelajar :  "+no_pendaftaran);
	
		System.out.print("\n\t Jabatan :  "+jabatan);
		
		System.out.print("\n\t Kelas :  "+kelas);
		
		System.out.print("\n");
		
		System.out.print("\n\n\t2. PAPARAN MAKLUMAT BUKU\n\n");
		
		System.out.print("\n\t Tajuk Buku Yang Dipinjam :  "+tajuk_buku);
		
		System.out.print("\n\t No Siri Buku :  "+no_siri);
		
		System.out.print("\n\t Tarikh Peminjaman Buku :  "+tarikhPeminjaman);
		
		System.out.print("\n\t Tarikh Pemulangan Buku :  "+tarikhPemulangan);
		
		System.out.print("\n\t Denda Yang Dikenakan Atas Kelewatan Pemulangan Buku :  "+denda);
		
		System.out.println("\n");
		
		System.out.print("\n\t ************************************************************\n\n");
	
		System.out.println("\n\t\t");
	}
	
	public static void main(String args[])throws IOException
	{
		String choice;
		
		PeminjamanBuku P1 = new PeminjamanBuku();
		choice = P1.menuList();
		P1.selectionCase(choice);
	}
}



Mod Edit: Please use code tags when posting your code. Code tags are used like so => :code:

Thanks,
PsychoCoder :)

Is This A Good Question/Topic? 0
  • +

Replies To: What character that suitable use for date in program

#2 erik.price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 485
  • View blog
  • Posts: 2,690
  • Joined: 18-December 08

Re: What character that suitable use for date in program

Posted 06 May 2009 - 12:25 PM

View PostAwing85, on 6 May, 2009 - 08:56 AM, said:

This is my program...


And...?
Are you having problems?

Please post in the correct forum. A moderator will move this post. Please do not repost in the Java forum.

[rules][/rules]

This post has been edited by erik.price: 06 May 2009 - 12:25 PM

Was This Post Helpful? 0
  • +
  • -

#3 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1638
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: What character that suitable use for date in program

Posted 06 May 2009 - 02:06 PM

Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:

  • Post the code you're having problems with (DONE)
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do
  • Post your question in the body of your post, not the description field


Also, moving this to the Java forum where it belongs :)
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: What character that suitable use for date in program

Posted 06 May 2009 - 07:37 PM

And what is the question ?
I guess the variables name are kind of useless for us :D looks like Punjabi but not sure... but anyhow wouldn't undertand anyhow
Still better than the A, b, c, d, e that we see many times
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1