Results 1 to 5 of 5
  1. #1
    adamrain is offline Member
    Join Date
    Nov 2009
    Posts
    19
    Rep Power
    0

    Default new week new asingment new problms...

    in this thread I hope to solve the 3rd assignment of my course and hope someone will help me .

    before you read : I learn in the biggest university in my country, they teach us the general topic and expect us to find a way to figure out the rest alone "reinvent the wheel" so I seek help elsewhere, this is my last course mostly because im broke, its object oriented programming with java I hope to make the most I can form this course(if you have a good heart or pity me or something els please help me).

    questions/assignments/problems:

    1)some unexplained asingment whith two codes full of Booleans I need to compare what they have in common .

    2)Boolean expression simplification ( this one ill handle myself).

    3)movie tickets selling machine! On java(ill start on it if ill have problems ill ask for help).

    4)some kind of tringle validation program whith 3 inputs for sides size I think.

    In shorts im f$!% but I have a few days for this.

    Im passing this damm course if it’s the last thin I do! ,its an openu so you pay for each course separately so the fact im broke now dosnt mean they can kick me next semester (or the one after it), so theirs hope for me to find a scholarship, as the saying goes "dgree for the rich"(or in my case the none black sheep parts of there families …so im fknd,this is when you know somone in your famly is filthy rich and dosnt like you too much...) .

    Well gotta get started…

    will post code soon.

  2. #2
    adamrain is offline Member
    Join Date
    Nov 2009
    Posts
    19
    Rep Power
    0

    Default

    here it goes the ticket machine:

    here what it shold do:*take the money
    *if its too much write the change
    *if its not enough give an input so the user will write the rest he needs to pay
    *its not all it do but that’s where I got stuck
    i trid to use the else if but bluej didnt let me ...shold of used eclipse ,the most of the problem is whith the ifs...ill try to give it another look tomrow.

    and the program shold run once...becuz the reast of my class havent learnd loops

    Java Code:
    import java.util.Scanner;
    public class TicketMachine
    {
    public static void main (String[ ] args)   { 
    final int price=50;
    //int ticketnum,need2pay,ticketbought;
    //double change,totalcost,moneypaid,monyleft2pay;
    
    
    
    
    System.out.println("a ticet will cost"+price);
    Scanner sinp = new Scanner(System.in);
    System.out.println("how many ticets would you like to buy?");
    int ticketnum=sinp.nextInt();
    double need2pay=price*ticketnum;
    System.out.println("cost to pay"+need2pay );
    double moneypaid=sinp.nextDouble();
    
    //i was asked "if" the buyr pays not while...i gess normall machines work on a loop but i wasnt asked to do so
    if (need2pay>=moneypaid ){
    double monyleft2pay=need2pay - moneypaid;
    if  (moneypaid >=need2pay ){
    double change=moneypaid-need2pay;
    System.out.println("you boght"+ticketnum+"tickts please go to the cashier he will give you the tickets,and take your dmm change too!:" +change+"god some people cant even do simple tasks");
    }
     if(monyleft2pay==0.0){System.out.println("you boght"+ticketnum+"tickts please go to the cashier he will give you the tickets" );}
    System.out.println("youve got "+ monyleft2pay+"leaft to pay");
    double payrest=sinp.nextDouble();
    
     if(payrest==monyleft2pay)
    System.out.println("you boght"+ticketnum+"tickts please go to the cashier he will give you the tickets" );
    
    
    }
    sinp. close();
    
    
             }
    }
    Last edited by adamrain; 12-06-2009 at 02:20 AM.

  3. #3
    adamrain is offline Member
    Join Date
    Nov 2009
    Posts
    19
    Rep Power
    0

    Default

    help anyone?

  4. #4
    dinosoep is offline Senior Member
    Join Date
    Nov 2009
    Posts
    150
    Rep Power
    5

    Default

    ome kind of tringle validation program whith 3 inputs for sides size I think.
    explain this a bit?

  5. #5
    adamrain is offline Member
    Join Date
    Nov 2009
    Posts
    19
    Rep Power
    0

    Default

    they didnt give me too much info,and they are the biggst univrsty in my countrey

    here is the input:5 4 3,15.32 18 12.7

    here is the output:1 4 3,15.32 18 -12.7

Similar Threads

  1. Current week number method
    By levent in forum New To Java
    Replies: 2
    Last Post: 02-01-2010, 04:33 AM
  2. Manipulate dates by week
    By quiterin in forum Advanced Java
    Replies: 1
    Last Post: 09-21-2009, 03:30 PM
  3. Day of the Week Calculator
    By scheng12 in forum New To Java
    Replies: 0
    Last Post: 09-08-2009, 03:59 PM
  4. calendar with week numbers of a current month
    By sridharnr in forum Java Servlet
    Replies: 1
    Last Post: 03-27-2009, 11:02 AM
  5. Get dates of current week
    By Qlubbie in forum New To Java
    Replies: 2
    Last Post: 11-19-2008, 09:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •