Page 303 - CA_Blue( J )_Class9
P. 303

SAMPLE PROJECTS





                                                                                          21 st   #Creativity & Innovativeness
                                                                                        Century
                                                                                         Skills  #Collaboration & Teamwork
                                 Write a project to display the electricity bill.
                  Project   1



















                   1      public class ElectricityBill
                   2      {

                   3           public static  void  main(String customerNumber, String customerName,
                               int oldReading, int currentReading)
                   4          {
                   5              int RENTAL_AMOUNT = 250;

                   6              int  unitsUsed;
                   7              double userAmount;

                   8              double Tax;
                   9              double Bill;

                  10
                  11              if (oldReading > currentReading)

                  12              {

                  13                    System.out.println("Old reading cannot be greater than the current
                              reading");
                  14                  System.out.println("Exiting...");
                  15                  System.exit(0);
                  16              }

                  17              //Calculate the bill amount

                  18                  unitsUsed = currentReading-oldReading;
                  19              if ( unitsUsed <= 100)
                  20                  userAmount =  unitsUsed*3.25;



                                                                                                Sample Projects  301
   298   299   300   301   302   303   304   305   306   307   308