Basic Java Program help needed urgently.

I have posted the instructions to my project assignment on here that is due tomorrow. I have spent an extremely large amount of time trying to get the basics of programming and am having some difficulty off of the bat. Someone who has more experience with this and could walk me through the steps is what I am hoping for. Any Help however will be greatly appreciated. I am putting in a lot of effort, but I am not getting the results I need. Thank you for the consideration of assisting me with my issues. If you have any questions please feel free to ask. I would love to open up a dialogue.
CIS 120
Mathematical Operators
Project-1
Max possible pts 100
Write a program “MathOperators” that reads two integers, displays user’s name, sum, product,
difference, quotients and modulus of the two numbers.
1. Create a header for your project as follows:
* Prgrammer: Your Name (1 pt) *
* Class: CIS 120 (1 pt) *
* Section: (1 pt) *
* Instructor: (1 pt) *
* Program Name: Mathematical Operators (1 pt) *
* Description: This java program will ask the user to enter two integers and *
display sum, product, difference, quotients and modulus of the two numbers
* (5 pts) *
2. Display a friendly message e.g. Good Morning!! (2 pts)
3. Explain your program to the user e.g. This java program can add, subtract, multiply,
divide and calculate remainder of any two integer numbers entered by you. Let’s get
started…. (5 pts)
4. Prompt the user- Please enter your first name, store the value entered by user in a
string variable name. Use input.next() instead of input.nextLine(). (8 pts)
5. Prompt the user- name, enter first integer number , store the value entered by user in
an integer variable num1.(5 pts)
6. Prompt the user- name, enter second integer number , store the value entered by user in
an integer variable num2.(5 pts)
7. Display the numbers entered by the user as: name has entered the numbers num1and
num2.(5 pts)
8. Calculate sum, product, difference, quotients and modulus of the two numbers. ( 30 pts)
9. Display sum, product, difference, quotients and modulus of the two numbers. ( 10 pts)
10. Terminate your program with a friendly message like- Thanks for using my program,
have a nice day!!(2 pts)

Nice try. You have not demonstrated that you've at least TRIED to do something. No one is going to do your homework for you. Your "urgency" is yours alone.

Similar Messages

  • Java Progrramming HELP, Needed Urgently, T hanks

    hey guys,
    I have this lab I need to be done tomorrow, its been weeks lol of thinking and figuring things out can someone make it work ? Pleaseeeee !
    I feel like going out and yelling for help lol I have been trying to figure this out for weeks now.
    I am pasting my Lab and My Codes I did so far, And Please I really need this done today at any rate, all help would be kindly appreciated.
    A Java program is required that will produce a number of reports based on the data from the Product file. This file contains the product name, cost, quantity and UPC. The file name must be input. Valid data from the file will be loaded into an array.
    A menu will provide the following options: (Note there are changes from previous assignment.)
    1     Display of all valid product information including extended price and GST including totals sorted by name.
    2     Display of all invalid records sorted by name.
    3     Search and display a certain product by name.
    4     Sort by UPC and use a binary search and display a certain product by UPC. (valid records)
    9 Exit.
    Processing requirements:
    Input the data from a file and load the records into an object array. Use this object array to produce the above reports.
    Code a class definition exactly as given in the following UML.
    (For specific students: you may code the UPC as an integer but if not numeric throw an exception that is handled in main. Document your choice in your submission).
    Product
    ? Name : String
    ? UPC : String
    ? Cost : Real
    ? Quantity : Integer
    + Product (Name : String, UPC : String, Cost : Real, Quantity : Integer)
    + Calculate Extended Cost() : Real
    + Calculate GST(): Real
    Input Record:
    Product name: String
    UPC: String
    Cost: real
    Quantity: integer
    Output Reports
    1. Display of all product information including extended cost and GST including totals of these 3 fields.
    Following is a sample of the output required:
    ************************ Product Cost REPORT ****************************
    Product                    Cost Quantity Extended Cost     GST     Total Cost
    Diamond Necklace 12345678901x 54,321.99 188 10,212,534.12 510,626.71 10,723,160.83
    Tissues 98989898989x 1.99 2 3.98      0.20     4.18
    TOTALS                         10,212,538.10 510,626.91 10,723,165.01
    2. Display of all invalid records and the count.
    Following is a sample of the output required:
    Invalid UPC Records = 1
    Count Record
    1          Tiara Diamond, 12345678901x, 36020.00, 2
    3. Search and display a certain product by name. Display appropriate message if not found.
    Following is a sample of the output required:
    Enter product name: CrownJewels
    CrownJewels 99999999991x     100,000.00 1 100,000.00 5,000.00 $105,000.00
    6. Display the product information sorted by name
    Following is a sample of the output required:
    ************************ Product Cost REPORT ****************************
    Product                    Cost Quantity Extended Cost     GST     Total Cost
    CrownJewels 99999999991x 100,000.00 1 100,000.00 5,000.00 $105,000.00
    Diamond Necklace 12345678901x 54,321.99 188 10,212,534.12 510,626.71 $10,723,160.83
    Pearls      88888888881x 10,000.00 1 10,000.00 500.00 $10,500.00
    RubyRing      77777777771x 10,000.00 1 10,000.00 500.00 $10,500.00
    Tissues      98989898989x 1.99 2 3.98 0.20     $4.18
    TOTALS          (complete these values)           xxx           xxx      xxx
    Java coding requirements for this assignment
    Main methods required
    1.     Load array with all records. Display exception messages only for records that have invalid data in any of the fields. Return array of valid records and logical size.
    2.     Validate the UPC. Display each report when requested from the menu.
    3.     Justify the data in the columns. Right justify numeric fields; left justify the alpha fields.
    4.     A method for each report required in the menu.
    Class methods
    5.     Use the object method for the extended cost.
    6.     Use the object method for the GST.
    You may use additional methods in the main program but do not add any methods in the class definition.
    Use DecimalFormat for rounding.
    Create an array to hold the objects. Assume that we only need to process a file of a maximum of 500 records but the file may be larger than 500 records.
    A Universal Product Code consists of 12 digits. The first digit (from the left) is the UPC type. The next five digits are the Manufacturer code. The next five digits are the product code which is assigned by the manufacturer. The final digit is the check digit. A person can determine the check digit of a Universal Product Code by doing the following:
    Step 1: Sum all of the digits in the odd positions together.
    0+4+0+1+5+9 = 19
    Step 2: Multiply the sum from Step 1 by 3.
    3 * 19 = 57
    Step 3: Sum all of the digits in the even positions together.
    6+2+0+1+8 = 17
    Step 4: Sum together the results from Step 2 and Step 3.
    17 + 57 = 74
    Step 5: Subtract the sum from the next highest multiple of 10.
    80 - 74 = 6 [check digit]
    TEST DATA:
    Step 1: Create 5 or MORE additional records that will test all conditions. Include these in your documentation. Identify what field is tested in your test data. (Example: error in each field of the record, rounding up, rounding down, valid UPC, invalid UPC, formatting of report, file too large
    Step 2: Use the file attached.
    GODDDDDDDDDDDDDD lol pasting it made me go crazy,
    these are my codes so far, HOwever the problem is ONLY DISPLAY MENU SHOWS, nothing else even though i have enough codes that it can show something,
    My codes are as follows:
    I am working on Eclipse.
    import java.util.Arrays;
    import java.util.Scanner;
    import java.io.*;
    import java.util.*;
    import java.io.IOException;
    * Name : Sana Ghani
    * Date : July 10
    public class lab56
         public static Scanner file;
         public static Scanner parse;
         public static Scanner input = new Scanner(System.in);
         public static Scanner searchInput = new Scanner(System.in);
         public static void main(String[] args) throws Exception
              Product1[] validProduct = new Product1[500];
              int logicalSize = 0;
              int menuChoice=0;
              String FileName = getFileName();
              displayMenu();
              switch(menuChoice)
              case 1:
                   displayAllValidRecords(validProduct, logicalSize);
                   try
                   // Open an output stream
                   OutputStream fout = new FileOutputStream ("myfile.txt");
                   // Print a line of text
                   new PrintStream(fout).println ("hello world!");
                   // Close our output stream
                   fout.close();          
                   // Catches any error conditions
                   catch (IOException e)
                        System.err.println ("Unable to write to file");
                        System.exit(-1);
                   break;
              case 2:
                   break;
              case 3:
                   binarySearchByName( validProduct,logicalSize);
                   break;
              case 4:
                   break;
              case 5:
                   break;
              menuChoice = displayMenu();
         public static void display(Product1[]validProduct, int logicalSize)throws Exception
              String Product, UPC;
              double Cost;
              int Quantity;
              for(int index =0; index<logicalSize; index++)
                   Product = validProduct[index].GetName();
                   UPC = validProduct[index].GetUPC();
                   Cost=validProduct[index].GetCost();
                   Quantity=validProduct[index].GetQuantity();
                   System.out.println(Product+"\t\t"+UPC+"\t\t"+Cost+"\t\t"+Quantity);
         public static String getFileName()
              String fileName;
              Scanner input = new Scanner(System.in);
              System.out.print("Please enter a file name: ");
              fileName = input.next();
              return fileName;
         public static int displayMenu()
              int menuChoice;
              boolean validFlag = false;
              do
                   System.out.println("\n\n*************************************");
                   System.out.println(" Product Display Menu ");
                   System.out.println("*************************************");
                   System.out.println("(1)Display All Records");
                   System.out.println("(2)Display All Invalid Records");
                   System.out.println("(3)Search by Product Name");
                   System.out.println("(4)Sort by Product Name");
                   System.out.println("(5)Exit");
                   System.out.println("*************************************");
                   System.out.print("Enter your choice(1-5): ");
                   menuChoice = input.nextInt();
                   if ((menuChoice >= 1) && (menuChoice <= 5))
                        validFlag = true;
                   if (!validFlag)
                        System.out.println("You have chosen " + menuChoice + ", " + menuChoice +
                        " is not valid. Please try again");
              }while(!validFlag);
              return menuChoice;
         public static String loadArray(Product1 [] ValidProduct, String fileName)throws Exception
              int logicalSize=0;//will always have to declare
              String record;//will always have to declare
              String Product, UPC;//variable names from
              double Quantity;
              double Cost;
              Scanner file = new Scanner(new File(fileName));//open
              record = file.nextLine();//read a line
              record = file.nextLine();//read a line
              for(int index = 0; index < ValidProduct.length && file.hasNext(); index++)//check to see if the file has data
                   record = file.nextLine();
                   parse = new Scanner(record).useDelimiter(",");
                   String Name = parse.next();
                   UPC = parse.next();
                   Cost = parse.nextDouble();
                   Quantity=parse.nextDouble();
                   ValidProduct[index] = new Product1 ( Name, UPC, Cost, (int) Quantity);
    //               create the object-- call the constructor and pass info
                   logicalSize++;
              return logicalSize+".txt";
         public static double roundDouble(double value, int position)
              java.math.BigDecimal bd = new java.math.BigDecimal(value);
              bd = bd.setScale(position,java.math.BigDecimal.ROUND_UP);
              return bd.doubleValue();
         * This method will print report about valid records
         public static void displayAllRecords( Product1[]valid, int ValidProduct,
                   Product1[] invalid, int InvalidProduct)
    //          Print valid records
              displayAllValidRecords(valid, ValidProduct);
    //          Print invalid UPC records
              displayAllValidRecords(invalid, InvalidProduct);
         public static void displayOneRecord(Product1[]valid, int index)
              double extendedCost, GST, SumofGST = 0, // Total Extended Cost
              totalCost, SumOfTotalCost = 0; // Total Extended Cost + GST
    //          Print title
              System.out.println(leftJustify("Product", 50) +
                        leftJustify("UPC", 15) +
                        rightJustify("Cost", 10) +
                        rightJustify("Quantity", 5) +
                        rightJustify("Extended Cost", 15) +
                        rightJustify("GST", 5) +
                        rightJustify("Total Cost", 13));
              extendedCost = valid[index].CalculateExtendedCost();
              extendedCost = roundDouble(extendedCost, 2);
              GST = valid[index].CalculateGST();
              GST = roundDouble(GST, 2);
              totalCost = extendedCost + GST;
              totalCost = roundDouble(totalCost, 2);
    //          justify method ensures all values are of the same size
              System.out.println(//leftJustify(i+"",3) + ": " +
                        leftJustify(valid[index].GetName(), 50) +
                        leftJustify(valid[index].GetUPC(), 15) +
                        rightJustify(valid[index].GetCost()+"", 10) +
                        rightJustify(valid[index].GetQuantity()+"", 5) +
                        rightJustify(extendedCost+"", 10) +
                        rightJustify(GST+"", 10) +
                        rightJustify(totalCost+"", 10));
         * This method will print report about valid records
         public static void displayAllValidRecords( Product1[]valid, int validCounter)
              double extendedCost, sumOfExtendedCost = 0, // Total Extended Cost
              GST, sumOfGST = 0, // Total GST
              totalCost, sumOfTotalCost = 0; // Total Extended Cost + GST
              System.out.println("************************ XYZ Product " +
                        "Cost REPORT ****************************" +
    //          Print title
              System.out.println(leftJustify("Product", 50) +
                        leftJustify("UPC", 15) +
                        rightJustify("Cost", 10) +
                        rightJustify("Qty", 5) +
                        rightJustify("Extended Cost", 15) +
                        rightJustify("GST", 5) +
                        rightJustify("Total Cost", 13));
    //          Print Records
              for(int i=0; i<validCounter; i++)
                   extendedCost = valid.CalculateExtendedCost();
                   extendedCost = roundDouble(extendedCost, 2);
                   GST = valid[i].CalculateGST();
                   GST = roundDouble(GST, 2);
                   totalCost = extendedCost + GST;
                   totalCost = roundDouble(totalCost, 2);
    //               justify method ensures all values are of the same size
                   System.out.println(//leftJustify(i+"",3) + ": " +
                             leftJustify(valid[i].GetName(), 50) +
                             leftJustify(valid[i].GetUPC(), 15) +
                             rightJustify(valid[i].getClass()+"", 10) +
                             rightJustify(valid[i].GetQuantity()+"", 5) +
                             rightJustify(extendedCost+"", 10) +
                             rightJustify(GST+"", 10) +
                             rightJustify(totalCost+"", 10));
                   sumOfExtendedCost += extendedCost;
                   sumOfGST += GST;
                   sumOfTotalCost += totalCost;
         private static void sortByName(Product1 [] ValidProduct, int logicalSize) throws Exception
              Product1 temp;
              for (int outer = logicalSize-1; outer > 1; outer --)
                   for (int inner = 0; inner < outer; inner ++)
                        if (ValidProduct[inner].GetName().compareToIgnoreCase(ValidProduct[inner+1].GetName())>0)
                             temp = ValidProduct[inner];
                             ValidProduct[inner] = ValidProduct[inner + 1];
                             ValidProduct [+ 1] = temp;
         public static void binarySearchByName(Product1 [] ValidProduct, int logicalSize)
              int high = logicalSize - 1;
              int low = 0;
              int mid = 0;
              int count = 0;
              int compare = 0;
              boolean found = false;
              System.out.print("Enter a product name");
              String product = input.nextLine();
              while (high >= low && !found)
                   count += 1;
                   mid = (high + low) / 2;
                   compare = ValidProduct[mid].GetName().compareToIgnoreCase(product);
                   if (compare == 0)
                        System.out.println("Found: " + ValidProduct[mid].GetName());
                        found = true;
                   else if (compare < 0)
                        low = mid + 1;
                   else
                        high = mid - 1;
              if (!found)
                   System.out.println(product + " not found.");
              System.out.println(count + " steps");
              System.out.println();
         public static String leftJustify(String field, int width)
              StringBuffer buffer = new StringBuffer(field);
              while (buffer.length() < width)
                   buffer.append(' ');
              return buffer.toString();
         public static String rightJustify(String field, int width)
              StringBuffer buffer = new StringBuffer(field);
              while (buffer.length() < width)
                   buffer.append(' ');
              return buffer.toString();
         public static void displayValidRecords(Product1 [] ValidProduct, int logicalSize) throws Exception {
              long longMAX_POSSIBLE_UPC_CODE = 999999999999L;
              // set input stream and get number
              Scanner stdin = new Scanner(System.in);
              System.out.print("Enter a 12-digit UPC number: ");
              long input =stdin.nextLong();
              long number = input;
              // determine whether number is a possible UPC code
              if ((input < 0)|| (input > longMAX_POSSIBLE_UPC_CODE)) {
                   // not a UPC code
                   System.out.println(input +"is an invalid UPC code");
              else {   
                   // might be a UPC code
                   // determine digits
                   int d12 = (int) (number % 10);
                   number /= 10;
                   int d11 = (int) (number % 10);
                   number /= 10;
                   int d10 = (int) (number % 10);
                   number /= 10;
                   int d9 = (int) (number % 10);
                   number /= 10;
                   int d8 = (int) (number % 10);
                   number /= 10;
                   int d7 = (int) (number % 10);
                   number /= 10;
                   int d6 = (int) (number % 10);
                   number /= 10;
                   int d5 = (int) (number % 10);
                   number /= 10;
                   int d4 = (int) (number % 10);
                   number /= 10;
                   int d3 = (int) (number % 10);
                   number /= 10;
                   int d2 = (int) (number % 10);
                   number /= 10;
                   int d1 = (int) (number % 10);
                   number /= 10;
                   // compute sums of first 5 even digits and the odd digits
                   int m = d2 + d4 d6 d8 + d10;
                   int n = d1 + d3 d5 d7 + d9 + d11;
                   // use UPC formula to determine required value for d12
                   int r = 10 - ((m +3*n) % 10);
                   // based on r, can test whether number is a UPC code
                   if (r == d12) {
                        // is a UPCcode
                        System.out.println(input+" is a valid UPC code");
                   else {   
                        // not a UPCcode
                        System.out.println(input+" is not valid UPC code");
    Any help would be great thanks !!
    Take care,

    1) It's your problem that you waited until the last minute before you went for help...not ours. We'll give your problem the same attention as anyone elses...therefore your problem isn't any more urgent than any other problem here.
    2) I don't intend on doing your entire assignment. Nor do I intend on reading all of it. If you need help with a specific requirement, then post the information/code relevant to that requirement. I don't know how to help you when you bury the problem inside a 9 mile long essay.
    3) Post code in tags so it's formatted and readable. (there's a *code* button up above that makes the tags for you).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Basic java problem help needed please

    the problem is :
    to produce a program which will show membership rates for a golf club..
    membership yearly rate new member joining fee
    category
    full 650 3000
    associate 200
    ladies 350 2000
    under 18 175
    new members must pay a joining fee in addition to the yearly rate as shown
    full/ladies members also prepay 150
    write a program which will enter details of members,calculate and output the total amount each member should pay.
    output number of members in each category
    the total income for each category....
    i need this program to show each category individually...cant do it at all..been at it a week....must be me && and || signs...i think...plz can someone help me as im really stuck now...thank you so much..
    import java.util.Scanner;
    public class assignmentquestion3 {
    public static Scanner key=new Scanner(System.in);
    public static void main(String []args){
    int fullfee=800,newfullfee=3800,associatefee=200,newla diesfee= 2350,ladiesfee= 350,under18fee = 175;
    int selectcat=0;
    int reply = 0;
    int addmember=0;
    int currentfulltotalmem=0,newfulltotalmem=0,associatet otalmem=0,ladiestotalmem=0,under18totalmem=0;
    int assoctotalcash=0,ladiestotalcash=0,under18totalcas h=0;
    int fullprepay=150;
    int ladiesfull=2500;
    int completefull = 0;
    int ladiescurrent=500;
    int under18=175;
    //Main introduction screen for the user and selections available. do while loops only allowing numbers 1,2,3 or 4.
    do{
    do{
    System.out.printf("\n\t %90s","********************Membership Rates For The Golf Club********************");
    System.out.printf("\n\n %105s","This program will allow users to enter details of members as well as calculating and.");
    System.out.printf("\n%106s","outputing the total amount each member should pay. The program allows users to view the");
    System.out.printf("\n%106s","total number of members in each category and the total income for each category.");
    System.out.printf("\n\n\t %75s","Please select your membership category: ");
    System.out.printf("\n\n\t %68s","Please press '1' for FULL");
    System.out.printf("\n\n\t %68s","Please press '2' for ASSOCIATE");
    System.out.printf("\n\n\t %68s","Please press '3' for LADIES");
    System.out.printf("\n\n\t %68s","Please press '4' for UNDER 18");
    System.out.printf("\n\n\t %68s","Please enter 1,2,3 or 4: ");
    selectcat=key.nextInt();
    }while (selectcat>4 || selectcat<1);
    do{
    System.out.printf("\n\n\t %75s","Are you a Current Member (press 1) or a New Member (press 2): ");
    reply=key.nextInt();
    }while (reply<1 || reply>2);
    //if number '1' for 'FULL' category is selected by the user and reply is 'yes'(1) then new full member fee is shown to user
    if (selectcat==1 ||reply==1)
    System.out.printf("\n\n\t %68s","CURRENT FULL MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Current full membership fees yearly are "+fullfee+"");
    System.out.printf("\n\n\t %68s","Full members must also pre-pay "+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %72s","The total of this membership is: "+fullfee+"");
    currentfulltotalmem=currentfulltotalmem+1;
    System.out.printf("\n\n\t %72s","The total number of 'CURRENT FULL MEMBERSHIPS = "+currentfulltotalmem+"");
    completefull=completefull+fullfee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'FULL MEMBERSHIPS' within the club = "+completefull+"");
    //if number '1' is selected by the user and reply is 'no' (2) then full member fee is shown to user
    else if (selectcat==1 &&reply==2)
    System.out.printf("\n\n\t %68s","NEW FULL MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Full membership fees yearly are "+newfullfee+"");
    newfulltotalmem=newfulltotalmem+1;
    System.out.printf("\n\n\t %68s","The total number of 'NEW FULL MEMBERSHIPS = "+newfulltotalmem+"");
    completefull=completefull+newfullfee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'FULL MEMBERSHIPS' within the club = "+completefull+"");
    //if number '2' is selected by the user then associate member fee is shown to user
    if (selectcat==2 &&(reply==1 || reply==2))
    System.out.printf("\n\n\t %75s","ASSOCIATE MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %75s","ASSOCIATE membership fees yearly are "+associatefee+"");
    associatetotalmem=associatetotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'ASSOCIATE MEMBERSHIPS' WITHIN THE CLUB = "+associatetotalmem+"");
    assoctotalcash=assoctotalcash+associatefee;
    System.out.printf("\n\n\t %68s","The total amount of income for 'ASSOCIATE MEMBERSHIPS' within the club = "+assoctotalcash+"");
    //if number '3' is selected by the user and reply is 'yes' then new ladies member fee is shown to user
    if (selectcat==3 &&reply==1)
    System.out.printf("\n\n\t %68s","LADIES CURRENT MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","Ladies full membership fees yearly are "+ladiesfee+"");
    System.out.printf("\n\n\t %68s","Ladies must also pre-pay "+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %68s","The total of this membership is: "+ladiescurrent+"");
    ladiestotalmem=ladiestotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'LADIES MEMBERSHIPS' WITHIN THE CLUB = "+ladiestotalmem+"");
    ladiestotalcash=ladiestotalcash+ladiescurrent;
    System.out.printf("\n\n\t %68s","The total amount of income for 'LADIES MEMBERSHIPS' within the club = "+ladiestotalcash+"");
    //if number '3' is selected by the user and reply is 'no' then the current ladies member fee is shown to user
    else
    if (selectcat==3 && reply==2)
    System.out.printf("\n\n\t %68s","LADIES NEW MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %68s","LADIES NEW MEMBERSHIP fees yearly are "+newladiesfee+"");
    System.out.printf("\n\n\t %68s","Ladies must also pre-pay "+fullprepay+" on a card can be used in the club facilities such as bar and shop ");
    System.out.printf("\n\n\t %68s","The total of this membership is: "+ladiesfull+"");
    ladiestotalmem=ladiestotalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'LADIES MEMBERSHIPS' within the club = "+ladiestotalmem+"");
    ladiestotalcash=ladiestotalcash+ladiesfull;
    System.out.printf("\n\n\t %68s","The total amount of income for 'LADIES MEMBERSHIPS' within the club = "+ladiestotalcash+"");
    //if number '4' is selected by the user then under 18 member fee is shown to user
    else if (selectcat==4 &&(reply==1||reply==2))
    System.out.printf("\n\n\t %75s","UNDER 18 MEMBERSHIP SELECTED");
    System.out.printf("\n\n\t %75s","UNDER 18 yearly membership fees are "+under18fee+"");}
    System.out.printf("\n\n\t %68s","The total of this membership is: "+under18+"");
    under18totalmem=under18totalmem+1;
    System.out.printf("\n\n\t %75s","The total number of 'UNDER 18 MEMBERSHIPS' within the club = "+under18totalmem+"");
    under18totalcash=under18totalcash+under18;
    System.out.printf("\n\n\t %68s","The total amount of income for 'UNDER 18 MEMBERSHIPS' within the club = "+under18totalcash+"");
    //allowing user to select '0' to add another member or any other key to exit program
    System.out.printf("\n\n\t %68s","Please Press '0' to add another member or any other key to exit.: ");
    addmember=key.nextInt();
    }while (addmember==0 ||addmember>1);}}
    the problem im having is whenever i make the choices 1,2,3,4 (CATEgorys) AND hit 1 or 2(current or new member selections) it brings up more than one category...
    for example when i hit 1(Category full) and 1(current member)..it displays this:
    Are you a Current Member (press 1) or a New Member (press 2): 1
    CURRENT FULL MEMBERSHIP SELECTED
    Current full membership fees yearly are 800
    Full members must also pre-pay 150 on a card can be used in the club facilities such as bar and shop
    The total of this membership is: 800
    The total number of 'CURRENT FULL MEMBERSHIPS = 1
    The total amount of income for 'FULL MEMBERSHIPS' within the club = 800
    The total of this membership is: 175
    The total number of 'UNDER 18 MEMBERSHIPS' within the club = 1
    The total amount of income for 'UNDER 18 MEMBERSHIPS' within the club = 175
    Please Press '0' to add another member or any other key to exit.:
    under 18 membership as well?...does this for other selections too...is it my arithmetic operators?....my if loops?...

    Multi-post [http://forums.sun.com/thread.jspa?threadID=5346248&messageID=10498270#10498270]
    And it still doesn't compile.

  • Java SDK Help Needed URGENTLY!

    Hi, as part of my uni course I am required to learn Java. Until now, I have only used it at uni and everything works fine. However, I decided to download Java 2 SDK from the Sun website (version 1.3.1_01).
    I am using Textpad as the editor and just installed Java by running the 32mb installer file. Textpad works fine and Java was installed to c:\jdk1.3.1_01
    Now, i created this simple program (from my tutorial notes) in Textpad:
    // The code below is held in a file called Exmpl1.java
    // This is Example1
    // The program requires you to type in your name.
    // Your name and a welcome message are then output to the screen
    import java.io.*;
    class Exmpl1M
    static BufferedReader keyboard = new
    BufferedReader (new InputStreamReader(System.in));
    static PrintWriter screen = new PrintWriter(System.out,true);
    public static void main (String[] args) throws IOException
    String name; // The place to store data entered from the keyboard
    // Prompt to the user of the program
    screen.print("Please enter your name ");
    screen.flush();
    // Get the data (a name) entered at the keyboard
    name = keyboard.readLine();
    screen.print("\n\nHello " + name );
    screen.println(" - Welcome to programming with Java\n\n");
    String lab; // The place to store data entered from the keyboard
    screen.print("What lab are you working in? ");
    screen.flush();
    // Get the data (a lab) entered at the keyboard
    lab = keyboard.readLine();
    screen.println("\n\n" + lab + "is a nice place to work!" );
    } // End of method main
    } // End of class Exmpl1M
    I know this file works ok because i have tested it on the uni computers. The Exmpl1M.class file is created where the Exmpl1M.java file is stored. It will compile fine using the Tools>Compile Java menu option.
    Now, here is the problem: when i go to Tools>Run Java Application, I get the message
    "Exception in thread "main" java.lang.NoClassDefFoundError: Exmpl1M
    Press any key to continue..."
    Now, seeing as how i am new to Java, i have no idea why i am getting this message. Should I have changed any settings when i installed Java? I'm guessing it may have something to do with "method main" in the coding, but we have always been told to put this but not told why.
    Please help cause i need to be able to write the progs at home too

    Is the name of the class the same as the class file
    Maybe you mixed up Exmple1 and Exmpl1M
    If this is ok then try this:
    I do not know Textpad so
    open Terminal/Console/DOS-Box go to directory where your Exmpl1.class file is located.
    Type in
    java Exmpl1
    If the program runs now some configuration in Textpad is wrong.
    Horst
    Hi, as part of my uni course I am required to learn
    Java. Until now, I have only used it at uni and
    everything works fine. However, I decided to download
    Java 2 SDK from the Sun website (version 1.3.1_01).
    I am using Textpad as the editor and just installed
    Java by running the 32mb installer file. Textpad works
    fine and Java was installed to c:\jdk1.3.1_01
    Now, i created this simple program (from my tutorial
    notes) in Textpad:
    I know this file works ok because i have tested it on
    the uni computers. The Exmpl1M.class file is created
    where the Exmpl1M.java file is stored. It will compile
    fine using the Tools>Compile Java menu option.
    Now, here is the problem: when i go to Tools>Run Java
    Application, I get the message
    "Exception in thread "main"
    java.lang.NoClassDefFoundError: Exmpl1M
    Press any key to continue..."
    Now, seeing as how i am new to Java, i have no idea
    why i am getting this message. Should I have changed
    any settings when i installed Java? I'm guessing it
    may have something to do with "method main" in the
    coding, but we have always been told to put this but
    not told why.
    Please help cause i need to be able to write the progs
    at home too

  • Programing help needed  urgently

    Please help with my home work I'm really stuck
    Read in an integer from the keyboard, then check to see whether it is :
    Positive or not
    Even or odd
    A multiple of 7 or not
    The number must be displayed together with each of the tests.
    I don't know how to check for a multiple of seven that were I had a problem.
    Here is the program that I have written so far. It is in java.
    import java.util.Scanner;
    public class hwork11
    public static void main (String[]args)
    Scanner input=new Scanner (System.in);
    System.out.println("please enter a number");
    int num=input.nextInt(System.in);
    if(num>0)
    System.out.println(num+" is negative"):
    else
    System.out.println(num+" is positive");
    if( num%2 == 0)
    System.out.println(num+" even number");
    else
    System.out.println(num+" odd number");
    }

    Vee190 wrote:Please help with my home work I'm really stuck
    Read in an integer from the keyboard, then check to see whether it is :
    Positive or not
    Even or odd
    A multiple of 7 or not
    The number must be displayed together with each of the tests.
    I don't know how to check for a multiple of seven that were I had a problem.
    Here is the program that I have written so far. *{color:#0000ff}({color}* It is in java. *{color:#0000ff}r u kiddin me )*
    *{color}*
    import java.util.Scanner;
    public class hwork11
    public static void main (String[]args)
    Scanner input=new Scanner (System.in);
    System.out.println("please enter a number");
    int num=input.nextInt(System.in);
    if(num>0) *{color:#0000ff}( I think that numbers >0 are +. Whuddya think?){color}*
    System.out.println(num+" is negative"):
    else
    System.out.println(num+" is positive");
    if( num%2 == 0) *{color:#0000ff}If num is 4, do know why this statement is true? (num % 2 == 0)*
    **The key to answering your question about whether or not a number is a multiple of 7 is understanding the use of the % operator. Look it up, and figure it out. You will learn programming languages much faster if you understand what it is you are typing, rather than just trying to make a program by copying lines of code out of the book.*{color}*
    System.out.println(num+" even number");
    else
    System.out.println(num+" odd number");

  • Some J2ME midlets doubts!! help needed urgently!!!

    Hi,
    I am currently working in a company where it does wireless technology like WAP and I am assigned a task of creating a screensaver midlet. I have some doubts on the midlets.
    1) How do i use a midlet suites? From what I heard from my colleagues & friends, a servlet is needed for midlets to interact with one another. is it true?
    2) How do I get the startin midlet to take note the phone is idling so that the screen saver midlet can be called?
    Help needed urgently... if there is any source codes for me to refer to would be better... Thanks...
    Leonard

    indicates that MIDlet suites are isolated (on purpose) from each other, so you can't write over another one's address space.
    Also, I believe (at least on cell phones) that you have to specifically enter the Java Apps mode; unless you do the app won't execute. If you are in Java apps mode and a call comes in, the cell's OS puts the Java app currently executing on "Pause" mode and switches back to phone mode.
    Not sure if you will be able to have a Java app do that automatically.
    BTW why do you need a screensaver on an LCD display? Is it really intended to show an advertisement?
    Download and real all the docs you can from Sun, once you get over the generic Java deficiencies MIDlet's aren't that hard.

  • HT201210 i have an error of no 11. kindly help, needed urgently

    i have an error of no 11. kindly help, needed urgently
    when i try to upgrage my
    iphone 3gs wit 4.1 to new latest 5.1
    it gives the erorr of 11. what that mean? Reply as soon as you can !
    thnx

    Error -1 may indicate a hardware issue with your device. Follow Troubleshooting security software issues, and restore your device on a different known-good computer. If the errors persist on another computer, the device may need service.

  • Load bar at start up, then shut down. HELP NEEDED URGENTLY!!! plss....

    Load bar at start up, then shut down. HELP NEEDED URGENTLY!!! plss..

    The startup disk may need repairing.
    Startup your Mac while holding down the Command + R keys so you can access the built in utiliites to repair the startup disk if necessary or restore OS X using OS X Recovery

  • New Java Programming Student Needs Help

    Hey everyone,
    I've just started taking a Java programming class at Penn State University, and I have had some prior experience with programming, i.e. C, C++, HTML, SQL. However, this will be my first attempt at Java. I know there are a lot of similarities between C++ and Java, but I'm still a little lost on some methodology.
    To get myself going, I've been looking through the textbook a little and came across a problem that gave me some difficulty. I'll write out the outline:
    A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and time and a half (i.e. 1.5 times their hourly wage) for overtime hours worked, commission workers (who receive $250 plus 5.7% of their gross weekly sales), and pieceworkers (who receive a fixed amount of money per item for each of the items they produce � each pieceworker in this company works on only one type of item).
    +Define a Java class named EmployeePayment that includes functionality to compute the weekly pay for each employee. You do not know the number of employees in advance. Each type of employee has its own pay code: Managers have paycode 1, hourly workers have paycode 2, commission workers have paycode 3 and pieceworkers have paycode 4.+
    +Define a main method that creates an instance of the EmployeePayment class, and calls the setManagerPay method to set the managers weekly salary to $625.00. The main method should then prompt the user for the paycode ��Enter paycode (-1 to end): �, validate the input and perform the associated processing for that paycode. Your program should allow the user to process employees until a paycode of -1 has been entered. Use a switch structure to compute each employee�s pay, based on the employee�s paycode. Within the switch, prompt the user (i.e. the payroll clerk) to enter the appropriate facts your program needs to calculate each employee�s pay based on that employee�s paycode, invoke the respective method (defined below) to perform the calculations and return the weekly pay for each type of employee, and print the returned weekly pay for each employee.+
    +Define a setManagerPay method that accepts and stores the fixed weekly salary value for managers.+
    +A private instance variable weeklyManagerPay should be defined in the EmployeePayment class to support these accessor and mutator methods.+
    +Define a calcManagerPay method that has no parameters and returns the fixed weekly salary.+
    +Define a calcHourlyWorkerPay method that accepts the hourly salary and total hours worked as input parameters and returns the weekly pay based on the hourly worker pay code description.+
    +Define a calcCommWorkerPay method that accepts the gross weekly sales as an input parameter and returns the weekly pay based on the commission worker pay code description.+
    +Define a calcPieceWorkerPay method that accepts the number of pieces and wage per piece as input parameters and returns the weekly pay based on the piece worker pay code description.+
    +Once all workers have been processed, the total number of each type of employee processed should be printed. Define and manage the following private instance variables (*numManager*, numHourlyWorker, numCommWorker, and numPieceWorker) within the EmployeePayment class. What are the ways in which these variables can be updated?+
    Sorry for the length, but I wanted this to be thorough. Basically, I'm having the most trouble writing the switch statement, and outputting the total number of each type of employee...
    Any help and pointers will be greatly appreciated...thanks all.

    You said you've written C and C++ code before. I don't have an excellent memory but from the little code that I wrote in C, I believe the switch statement is exactly the same.
    Read this: [http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html]
    If you're having trouble understanding something post what your specific problem is. No one is going to write your homework for you, but many, myself included, would be more than willing to help if you're really stumped. Just post your concise problem.
    Edited by: sheky on Mar 12, 2008 9:52 PM

  • Intro To Java Programming student needing help on how to download java SDK on 10.6.8

    Hey Ladies and Gents,
    For the past hour I have been trying to download Java SDK for my 10.6.8 Mac. Can someone point me in the right direction. I am taking a course in intro to Java programming and the book I am using isnt as helpful as I hoped.

    SE 6 development kits support SE 5 constructs.  Just watch that you use only SE 5 constructs.  Texts on 5 will not list the 6 constructs, and texts on 6 are available that tell what came when.
    There is another forum (https://discussions.apple.com/community/developer_forums) where "developers" troll for questions to answer, and your developer questions will stay at the top of the list longer than in MacbookPro forum.

  • Dollar Change Program Help needed!!

    I need some immediate help writing a java program that determines change of 1 dollar recieved in the amout of quarters, dimes, and nickels when an item is purchased between the prices of 25cents and a dollar. For Example:
    Total Money: $1 (static)
    Enter the price of the item in cents: 45
    You bought an item for 45 cent and gave me a dollar, so your change is:
    2 quarters,
    0 dimes, and
    1 nickel.
    That is the basics of what I need, and I am not sure where to start.

    My program works as long as there is at least 1 penny to be given back in the change. I need help!
    //          CoinCounter.java
    //          This program counts the change given back from 1 dollar
    //          in specific values such as quarters, dimes, and nickels
    //          and pennies.
    //          Written By Jasen Hudson
    import javax.swing.*;
    import cs1.Keyboard;
    public class CoinCounter
    {// Begin class CoinCounter
         public static void main(String[] args)
              {// Begin main method
                   int cost = 0;
                   int dollar = 100;
                   int quarter = 25;
                   int dime = 10;
                   int nickel = 5;
                   int penny = 1;
                   int numQuarters = 0;
                   int numDimes = 0;
                   int numNickels = 0;
                   int numPennies = 0;
    //Item amount input
    String input = JOptionPane.showInputDialog
    ("Please enter the amount paid for the item.");
    cost = Integer.parseInt(input);
    //While statement
         int changeRequired = dollar - cost;
         while(changeRequired > 0){
              if((changeRequired - quarter>= 0){
              numQuarters ++;
                   changeRequired -= quarter;
                        continue;
              if(changeRequired - dime >= 0){
              numDimes ++;
                   changeRequired -= dime;
                        continue;
              if(changeRequired - nickel >= 0){
              numNickels ++;
                   changeRequired -= nickel;
                        continue;
              if(changeRequired - penny >= 0){
              numPennies ++;
                   changeRequired -= penny;
    //Amount of change needed to give back
         int change = dollar - cost;
    //System print out
         System.out.println("The change required for $1.00 from an item costing "
              + cost + " Cents is " +change+ ". Here is your change:");
              System.out.println(numQuarters+" Quarters");
              System.out.println(numDimes+" Dimes");
              System.out.println(numNickels+" Nickels");
              System.out.println(numPennies+" Pennies");
              System.exit(0);
    }

  • Help needed urgently on a problem..plzzz

    hi..this is a linear congruential generator. I have to implement it and i need the execution time for the program.
    for your understanding i'm providing an example below.
    Xn=(( a* xn-1 )+b) mod m
    If X0=7 ; a = 7 ; b =7 ; m=10
    Then
    X0 = 7
    X1 =((7 * 7) + 7))mod 10 = 6
    X2 = ((6*7)+7))mod 10 = 9
    X3 = ((9*7)+7) mod 10 = 0
    X4 = ((0*7)+7) mod 10 = 7
    Now since the cycle is being repeated i.e 7 appears again�so the period is 4 coz there are 4 diff nos. i.e 7,6,9,0�..
    help required urgently....your help will be appreciated...thankyou..

    Hi,
    I wrote the code so that it catches any cycle (not only the "big" one).
    Otherwise it will enter infinite loop...
    The time complexity is O(N*logN): it can do at most N iterations (here N is your 'm'), and in each iteration there can be O(log N) comparisons (since I maintain TreeSet).
    Interesting issue: is it possible to supply such (x0, a, b, m) tuple such that all possible values from 0 to m-1 will be output? I think no :)
    Here is the program:
    package recurr;
    import java.util.TreeSet;
    import java.util.Comparator;
    public class Recurrences {
         private static long x0, a, b, m;
         private static TreeSet theSet;
         public static void main(String[] args)
              long l0, l1, l2, l3;
              try {
                   x0 = Long.parseLong(args[0]);
                   a = Long.parseLong(args[1]);
                   b = Long.parseLong(args[2]);
                   m = Long.parseLong(args[3]);
              } catch(NumberFormatException nfe) {
                   nfe.printStackTrace();
              System.out.println("X[0]: " + x0 + "\n");
              long curr = x0;
              boolean cut = false;
              int i;
              // initialize the set
              theSet = new TreeSet(new LongComparator());
              // we can get at most m distinct values (from 0 to m-1) through recurrences
              for(i=1; i <= m; ++i) {
                   // iterate until we find duplicate
                   theSet.add(new Long(curr));
                   curr = recurrence(curr);
                   if(theSet.contains(new Long(curr))) {
                        cut = true;
                        break;
                   System.out.println("X[" + i + "]: " + curr + "\n");
              if(cut) {
                   System.out.println("Cycle found: the next will come " + curr + "\n");
              } else {
                   System.out.println("No cycle found!");
              System.out.println("----------------------------------");
              System.out.println("Totally " + (i-1) + " iterations");
         private static long recurrence(long previous)
              return (a*previous + b)%m;
         static class LongComparator implements Comparator
              public int compare(Object o1, Object o2)
                   if(((Long)o1).longValue() < ((Long)o2).longValue()) {
                        return -1;
                   } else if(((Long)o1).longValue() > ((Long)o2).longValue()) {
                        return 1;
                   } else return 0;
    }

  • Java Programming Help

    I'm new to Java programming, and I have a pretty basic question. I'm writing a simple loan calculator, and I need to know how to format the output of my variables to two decimal places. I've been doing this for about a week, so be nice, please.
    Thanks in advance,
    Wayne

    NumberFormat nf = NumberFormat.getCurrencyInstance();
    double cash = 123.45;
    System.out.println(nf.format(cash));
    Your First Cup of Java
    Essentials, Part 1, Lesson 1: Compiling & Running a Simple Program
    The Java Tutorial - A practical guide for programmers
    New to Java Center
    How To Think Like A Computer Scientist
    Introduction to Computer Science using Java
    The Java Developers Almanac 1.4
    JavaRanch: a friendly place for Java greenhorns
    jGuru
    Object-Oriented Programming Concepts
    Object-oriented language basics
    Don't Fear the OOP
    Books:
    Bert Bates and Kathy Sierra's Head First Java
    Bruce Eckel's Thinking in Java (Free online)
    Joshua Bloch's Effective Java
    Java Design: Building Better Apps and Applets (2nd Edition)

  • Basic Java programs.....Please read

    I just need some links to where i can dowload some some basic toolboxes and kits. (to make basic programs and practice)
    Please porvide links, i've been searching. Since I'm so unfamiliar with Java programming i haven't has much luck.

    JSE 1.5 download: http://java.sun.com/javase/downloads/index.jsp
    vim download: http://www.vim.org/download.php
    kind regards,
    Jos

  • Help needed Urgently- Rebate based on collected amount

    Dear all,
    I come across scenario while discussiion with client that they require rebate with collection. Details of the requirement are given below:
    1. SAP rebates run on billed values & set the accrual in rebate agreement on the rate what we have specified in the rebate agreement. Requirement is that, If i have billed on 1000$ & my accrual value is 100$ with the rate of 10%. If i collected 800$ instead of 1000$, then i need to pay the accrual on the basis of 800$ not on the basis of 1000$. It means i have to adjust accrual amount on the basis of 800$. Conclusion is that i have to pay not 100$ accrual instead less then 100$ on the basis of 800$ which i collected.
    2. In month 1 have billed on 5000$, my accrual amount is 500$ with rate of 10%. In the 2nd month i have to bill 1000$ and i have given an discount of 500$, it means my billed value is 500$ and my accrual amount is 50$@10%. In month 3 again i billed 500$ and my accrual amount is 50$@10%.
    Requirement is that, when i am going to pay the accrual to client, i should pay correct accrual for which he is entitled for. Means i should pay 100$ accrual not 600$ because i have already given an discount of 500$. Discount which i have given already of 500$ should need to be offest with the first month accrual of 500$. So remaning accrual is 100$.
    Great if somebody can help me out for the solutioning of the above requirements.

    Thanks Ivano,
    Somebody has started the conversation.
    Let me put my questions again.
    This requirement is nothing to do with Payment procedure in the agreement type.
    1. In any month if i billed 1000$, so my account receivable would be 1000$. My rebate for that month is 100$ at the rate of 10%. During customer receipt if i collected against my invoice 900$ instead of 1000$, my accrual needs to be corrected 90$ instead of 100$.
    I know this can not be fullfilled by standard SAP, by any thoughts on this welcomed.
    2. I know Rebate can be settled partially or full settlement by payment method( by cheque, bank transfer, or by credit memo) we have configure in rebate agreement type. But here requirement is totally different.
    Here, i need to pay the Rebate as a Discount instead of by cheque or by credit memo. While doing the partial or full settlement system will take into account collected accrual up to that day & apply as a discount to the final bill.
    Scenario is like that sometimes customer asked to give us the discount on bill for whatever they accrued so far.
    This is again cannot solved by standard SAP, but any thought by any body welcome. We have already thought that we need to enhance the solution.
    Solution needed urgently.

Maybe you are looking for

  • How to stop a process (that is executing)

    Hi all my question is How to stop a process that is executing ? some other languages has a function called yield() in java how I can do it. thanks

  • Ipad 1 doesnt import my photos in iphoto, seems stuck

    Got some 500 pictures (5.7 GB) on my Ipad-and left it running for one night... Still see no advance in the process of iphoto import... am I just impatient or is the process frozen somehow? The button "import all" and import selected are grey... but I

  • M2ts AVCHD suddenly giving unsupported compression error

    Hi -- I spent all day yesterday doing a rought cut of some AVCHD footage, closed the project last night and tried to open it this morning and suddenly all my AVCHD footage is "offline." If I try to relink it I get an error message saying the files ha

  • HT201263 Cannot restore ipad mini after update on configurator

    Please help!  I have tried restoring from itunes 3 times and each time it gets to the end, says it's processing the file and then jumps back to the ipad recovery mode....

  • Exclamations and Checks, what do they mean?

    I was wondering what the ! beside some of my songs means, aswell as why are some of the songs "Checked" and some aren't? What do these things mean and also if I delete a song from my library does it delete it from my ipod? If my ipod is maxed out, ho