1)DEFINITION OF DATA REQUIREMENTS
Produce an itemised consigment note for each customer including
-dimension,weight and price per parcel.
-total weight and price consigment
-number of parcels

RESIDENT DATA
-up to 2kg-£7.50
-up to 4kg-£8.00
-up to 10kg-£8.55
-up to 12kg-£9.10
-up to 14kg-£9.70
-up to 16kg-£10.35
-for each extra 2kg,up to 30kg,add £0.90

USER INTERFACE DESIGN
itemised consigment note produced for each year.This reports contains information required as discussed above in the data requirements section.the customer data destination is shown clearly at the top,followed by details of all parcels and lastly summary information is printed.
CONSIGNMENT:1
CUSTOMER:A

DESTINATION:THE AVENUE,OUTMARKET,BIRMINGHAM
INSTRUCTION:AFTER6 PM

PARCEL LENGTH BREADTH HEIGHT WEIGHT COST
1 0m 0m 0m 2kg £7.50
2 1m 1m 0m 15kg £12.15

VALIDATION
the following checks will be carried out,and prevent the user from continuing if invalid data is enter.
- parcel length,breadth,height,weight must be numeric.
- parcel length must be > 0 and <=1.5m
- parcel breadth must be > 0 and <=1.5m
- parcel height must be > 0 and <=1.5m
- size pf parcel must be <=3m(length+breadth+height<=3m)
- parcel weight must be >=1kg and <=30kg
- weight of whole consignment must be <=200kg

examples validation codes
if parcellenght + parcelbreadth + parcelheight > 3 then
msgbox "There is a problem,the lenght.breadth and height cannot add up to more than 3m,otherwise the parcel cannot be sent"
end if

import javax.swing.JOptionPane;
import java.util.Scanner;

public class PackageService {

public static void main(String[] args) {



        // Declare Variables

        String accept, customerid, destination, instructions;

        int consignment, parcelnum, cnt, totalweight=0;

        double totalcost;




    accept = JOptionPane.showInputDialog(null,"How Many Parcels To Send");
    parcelnum = Integer.parseInt(accept);

    int[] records;
    records = new int[parcelnum];

    int[] length;
    length = new int[parcelnum];

    int[] breadth;
    breadth = new int[parcelnum];

    int[] height;
    height = new int[parcelnum];

    int[] weight;
    weight = new int[parcelnum];


    double[] cost;
    cost = new double[parcelnum];


    accept = JOptionPane.showInputDialog(null,"What Is Consignment Number");
    consignment = Integer.parseInt(accept);

    customerid = JOptionPane.showInputDialog(null,"Enter Customer ID");

    destination = JOptionPane.showInputDialog(null,"Enter Destination");

    instructions = JOptionPane.showInputDialog(null,"Enter Instructions");


    for(int i=0; i<parcelnum; i++)

       {
        cnt = i +1;
     accept = JOptionPane.showInputDialog(null,"Enter Length of Parcel " +cnt);
        length[i] = Integer.parseInt(accept);

        accept = JOptionPane.showInputDialog(null,"Enter Breadth of Parcel " +cnt);
        breadth[i] = Integer.parseInt(accept);

        accept = JOptionPane.showInputDialog(null,"Enter Height of Parcel " +cnt);
        height[i] = Integer.parseInt(accept);

        accept = JOptionPane.showInputDialog(null,"Enter Weight of Parcel " +cnt);
        weight[i] = Integer.parseInt(accept);

        totalweight=totalweight + weight[i];

       }


     JOptionPane.showMessageDialog(null,"The Total Weight is " + totalweight);



        System.exit(0);

      }

}

have try the best i could but dont know why is not working on jcreator..kepping repeating mm

Edited 5 Years Ago by Ezzaral: Added code tags. Please use them to format any code that you post.

dont know why is not working

Please explain. If there is output, please copy and paste it here and explain what is wrong with it and show an example of what it should be.

have try the best i could but dont know why is not working on jcreator..kepping repeating mm

so, it keeps repeating mm? could you be a bit more specific as to what 'mm' is?
I ran your code here, and it works just fine.

yes, you do get quite some message boxes for each parcel, and if you say you want to send 500 parcels, it might seem that it is repeating endlessly, but if you try it and specify you just want 2 parcels sent (a lot better for testing purposes) you'll see nothing is wrong.

import javax.swing.JOptionPane;
import java.util.Scanner;
public class PackageService {
public static void main(String[] args) {

        // Declare Variables
        String accept, customerid, destination, instructions;
        int consignment, parcelnum, cnt, totalweight=0;
        double totalcost = 0;


    accept = JOptionPane.showInputDialog(null,"How Many Parcels To Send");
    parcelnum = Integer.parseInt(accept);
    int[] records;
    records = new int[parcelnum];
    int[] length;
    length = new int[parcelnum];
    int[] breadth;
    breadth = new int[parcelnum];
    int[] height;
    height = new int[parcelnum];
    int[] weight;
    weight = new int[parcelnum];
    int[] size;
    size = new int[parcelnum];
    

    double[] cost;
    cost = new double[parcelnum];

    accept = JOptionPane.showInputDialog(null,"What Is Consignment Number");
    consignment = Integer.parseInt(accept);
    customerid = JOptionPane.showInputDialog(null,"Enter Customer ID");
    destination = JOptionPane.showInputDialog(null,"Enter Destination");
    instructions = JOptionPane.showInputDialog(null,"Enter Instructions");

    for(int i=0; i<parcelnum; i++)
       {
        cnt = i +1;
     accept = JOptionPane.showInputDialog(null,"Enter Length of Parcel " +cnt);
        length[i] = Integer.parseInt(accept);
        accept = JOptionPane.showInputDialog(null,"Enter Breadth of Parcel " +cnt);
        breadth[i] = Integer.parseInt(accept);
        accept = JOptionPane.showInputDialog(null,"Enter Height of Parcel " +cnt);
        height[i] = Integer.parseInt(accept);
        accept = JOptionPane.showInputDialog(null,"Enter Weight of Parcel " +cnt);
        weight[i] = Integer.parseInt(accept);
        totalweight=totalweight + weight[i];
       }

       for(int i=0; i<parcelnum; i++)
       {
        if(legnth[i]> 0 && length[i] <= 1.5 || breadth[i]> 0 && breadth[i] <= 1.5 || height[i]> 0 && height[i] <= 1.5 )
           {
               size[i] = length[i] + breadth[i] + height[i]; 
               
             if(size[i] <= 3 && weight[i] <= 30 && totalweight <= 200)
               {
                 if(totalweight <= 2) 
                   {
                    cost[i] = 7.50 * totalweight;   
                       } 
                       
                   if(totalweight > 2 && totalweight <=4) 
                   {
                    cost[i] = 8.0 * totalweight;   
                       } 
                       
                     if(totalweight > 4 && totalweight <=6) 
                   {
                    cost[i] = 8.55 * totalweight;   
                       }  
                       
                     if(totalweight > 6 && totalweight <=8) 
                   {
                    cost[i] = 9.10 * totalweight;   
                       }
                       
                     if(totalweight > 8 && totalweight <=10) 
                   {
                    cost[i] = 9.75 * totalweight;   
                       }
                       
                     if(totalweight > 10 && totalweight <=12) 
                   {
                    cost[i] = 10.3 * totalweight;   
                       }                
                   
                   if(totalweight > 12) 
                   {
                    
                    cost[i] = (10.3 * totalweight) + ( ((totalweight - 12) /2) * 0.99);   
                       } 
                   
                   totalcost = totalcost + cost[i];    
                       
                   }  
              else
              {
                  JOptionPane.showMessageDialog(null,"There is a problem with the size of the parcel");
                  } 
            }
         else 
         {
           JOptionPane.showMessageDialog(null,"There is a problem with the size of the parcel");   
             }
       }
     
     
JOptionPane.showMessageDialog(null,"The Total Cost is " + totalcost);

        System.exit(0);
      }
}

its giving me errors cannot find symbol variable lenght

Edited 5 Years Ago by Ezzaral: Added code tags. Please use them to format all code that you post.

its giving me errors cannot find symbol variable lenght

Please copy and paste here the the FULL text of the error message.

Please edit your code and wrap it in code tags. Use the [code] icon above the input box.

import javax.swing.JOptionPane;
import java.util.Scanner;
import javax.swing.JOptionPane;
import java.util.Scanner;
public class PackageService {
public static void main(String[] args) {

        // Declare Variables
        String accept, customerid, destination, instructions;
        int consignment, parcelnum, cnt, totalweight=0;
        double totalcost = 0;


    accept = JOptionPane.showInputDialog(null,"How Many Parcels To Send");
    parcelnum = Integer.parseInt(accept);
    int[] records;
    records = new int[parcelnum];
    int[] length;
    length = new int[parcelnum];
    int[] breadth;
    breadth = new int[parcelnum];
    int[] height;
    height = new int[parcelnum];
    int[] weight;
    weight = new int[parcelnum];
    int[] size;
    size = new int[parcelnum];


    double[] cost;
    cost = new double[parcelnum];

    accept = JOptionPane.showInputDialog(null,"What Is Consignment Number");
    consignment = Integer.parseInt(accept);
    customerid = JOptionPane.showInputDialog(null,"Enter Customer ID");
    destination = JOptionPane.showInputDialog(null,"Enter Destination");
    instructions = JOptionPane.showInputDialog(null,"Enter Instructions");

    for(int i=0; i<parcelnum; i++)
       {
        cnt = i +1;
     accept = JOptionPane.showInputDialog(null,"Enter Length of Parcel " +cnt);
        length[i] = Integer.parseInt(accept);
        accept = JOptionPane.showInputDialog(null,"Enter Breadth of Parcel " +cnt);
        breadth[i] = Integer.parseInt(accept);
        accept = JOptionPane.showInputDialog(null,"Enter Height of Parcel " +cnt);
        height[i] = Integer.parseInt(accept);
        accept = JOptionPane.showInputDialog(null,"Enter Weight of Parcel " +cnt);
        weight[i] = Integer.parseInt(accept);
        totalweight=totalweight + weight[i];
       }

       for(int i=0; i<parcelnum; i++)
       {
       if(legnth[i]> 0 && length[i] <= 1.5 || breadth[i]> 0 && breadth[i] <= 1.5 || height[i]> 0 && height[i] <= 1.5 )
       {
               size[i] = length[i] + breadth[i] + height[i];
          if(size[i] <= 3 && weight[i] <= 30 && totalweight <= 200)
               {
                 if(totalweight <= 2)
                   {
                    cost[i] = 7.50 * totalweight;
                       }

                   if(totalweight > 2 && totalweight <=4)
                   {
                    cost[i] = 8.0 * totalweight;
                       }

                     if(totalweight > 4 && totalweight <=6)
                   {
                    cost[i] = 8.55 * totalweight;
                       }

                     if(totalweight > 6 && totalweight <=8)
                   {
                    cost[i] = 9.10 * totalweight;
                       }

                     if(totalweight > 8 && totalweight <=10)
                   {
                    cost[i] = 9.75 * totalweight;
                       }

                     if(totalweight > 10 && totalweight <=12)
                   {
                    cost[i] = 10.3 * totalweight;
                       }

                   if(totalweight < 12)
                   {

                    cost[i] = (10.3 * totalweight) + ( (totalweight - 12) * 0.99);
                       }

                   totalcost = totalcost + cost[i];

                   }
              else
              {
                  JOptionPane.showMessageDialog(null,"There is a problem with the size of the parcel");
                  }
            }
         else
         {
           JOptionPane.showMessageDialog(null,"There is a problem with the size of the parcel");
             }
       }


JOptionPane.showMessageDialog(null,"The Total Cost is " + totalcost);

        System.exit(0);
      }
}

errors is i cannot find symbol variable lenght on jcreator..i dont know why

Edited 5 Years Ago by Ezzaral: Fixed tags.

Please copy and paste here the the FULL text of the error message.

Please edit your code and wrap it in code tags. Use the [code] icon above the input box.

cannot find symbol variable lenght

Then it is NOT in your program.

Edited 5 Years Ago by NormR1: n/a

I'm not trying to run the code until you post all the error messages and can get your code to compile and execute. When you have made all the changes and have a clean compile and are having a problem with the logic, then I'll copy the code for testing.
If I copy this dirty broken code, I'll only have to replace it when you make changes.

Please copy and paste here the the FULL text of the error message.

Please edit your code and wrap it in code tags. Use the [code] icon above the input box.

your problem is, you've spelled it:

legnth

in your code. read the stacktrace you get, and it will point you to exact which line in your code the error is, just fix it, and it will compile and run.

@Samantha12
Please start your own thread. Copy and paste the code on the forum and add questions and comments to the parts of it you don't understand

Edited 5 Years Ago by NormR1: n/a

This article has been dead for over six months. Start a new discussion instead.