JCC CSC 1590 Computing Fundamentals I

Fun For Everyone

5.2 Pre- Lab code




Nick will be posting the working code her.

Create a free edublog to get your own comment avatar (and more!)

7 Responses to “5.2 Pre- Lab code”

  1.   Lbboy45 Says:

    import javax.swing.JOptionPane;

    public class Trucks
    {
    public static void main(String[]args)
    {
    int index, weight, count=0;
    String outputStr;
    int[] maxWeight={50000,25000,20000,35000,40000,25000,30000};

    outputStr= (”This program asks the user for the truck number\n”
    + “and the weigh-in value for each truck in a fleet.\n\n”
    +”The weigh-in value is compared to the established\n”
    + ” maximum weight limit. A message is displayed to tell\n”
    + ” the user whether the truck is or is not within weight”
    + “limits.\n\n”);

    do
    {
    index= Integer.parseInt(JOptionPane.showInputDialog( “Please enter the truck”
    +” number: “));

    if(index maxWeight.length)
    {
    JOptionPane.showMessageDialog(null,
    “You entered an incorrect truck number.”,
    “Incorrect Truck Number Message”,
    JOptionPane.INFORMATION_MESSAGE);
    }
    else
    {
    weight=Integer.parseInt(JOptionPane.showInputDialog(
    “Please enter the truck weight: “));

    if (weight

  2.   Lbboy45 Says:

    if (weight

  3.   Lbboy45 Says:

    JOptionPane.showMessageDialog(null,
    “You entered an incorrect weight number.” ,
    “Incorrect Truck Weight Message”,
    JOptionPane.INFORMATION_MESSAGE);

    else
    {
    if(maxWeight[index-1]

  4.   Lbboy45 Says:

    JOptionPane.showMessageDialog(null,
    “You have exceeded your allowable weight allowance.”,
    “Truck Excess Weight Message”,
    JOptionPane.INFORMATION_MESSAGE);
    count++;
    }
    }
    }while (count

  5.   Lbboy45 Says:

    maxWeight.length);

    JOptionPane.showMessageDialog(null,”All tr ucks have weighted-in.”,
    “Truck Weigh-in Complete Message”, JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
    }//end main
    }//end class

  6.   ubcesp Says:

    Well done boys! Great news!

  7.   Penis enlargement Says:

    For penis enlargement visit http://www.hqpicture.com

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image