Search This Blog

Saturday 15 October 2016

BOOK FAIR PROGRAM

import java.io.*;
class bookfair
{
    //instance variables
    String bname;
    double p;
    double np;
  bookfair()
  {
      bname="";
      p=0.00f;
      np=0.00f;
 
  }
  void input() throws IOException
  {
      BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      System.out.println("enter the book name");
      bname=br.readLine();
      System.out.println("enter the price");
      p=Double.parseDouble(br.readLine());
    
  }
   void calculate()
   {
    if(p<=1000)
    {
    np=p-(p*0.2);
}
    else if(p>1000 && p<=3000)
  {
    np=p-(p*0.1);
}
    else
{
    np=p-(p*0.15);
   
    }
}

void display()
{
   System.out.println("book name\t"+"price\t"+"net peice\t");
   System.out.println(bname+"\t"+p+"\t"+np);

}
public static void main(String []args) throws IOException
{
    bookfair obj=new bookfair();
    obj.input();
    obj.calculate();
    obj.display();
}
}

1 comment:

  1. Sands Casino | New Jersey online casino
    The Sands Casino in New Jersey is now open and accepting players from around the world. It has 1,700 카지노사이트 slot machines and septcasino online casino games 바카라 from leading game

    ReplyDelete

Make a JAVA program for a Toystore. This program suggest the toy based on the inputs users gives like age , gender , etc

 //editor used - IntelliJ IDEA package ToyStore; import javax.swing.*; import java.awt.event.*; import java.util.Scanner; //here you can edi...