Hi im new in Java. i have this case study and i don't know how im gonna do it.

my professor wants me to create a menu or message box that has 3 options

ex.

[ 1 ] Addition
[ 2 ] Subtraction
[ 3 ] Exit

____________

*________ this signifies a input box

if i will choose option [ 1 ] there should be another message box that will appear. inside this message box is an input box that lets u input two numbers and it will perform addition.

same as subtraction. and etc.

i need this asap.. if u cud help me now it would be better.. tnx a lot..

Recommended Answers

All 6 Replies

show some effort and come up with real questions. Don't just copy your entire assignment and wait for people to do it for you.

1) We're not here to do your homework.
2) If you don't do it yourself you'll never learn anything, and we don't want stupid kids with worthless diplomas joining the labour force.

NEVER TREAT A NEWBIE LIKE THAT

import java.util.Scanner;
class someProggram {
 public static void main(String args[]) {
  Scanner myScanner = new Scanner (System.in);
  int sum = 0, average, largest = 0, number1, number2, smallest;
  int choice ;
  
  
 do {
  
   System.out.println("Which of the following would you like to do ");
   System.out.println("1) Find the sum");
   System.out.println("2) Find the average");
   System.out.println("3) Find the largest");
   System.out.println("4) Find the smallest");
   System.out.println("5) Quit");
   choice = myScanner.nextInt();
    
    if (choice == 1) {
     System.out.print("Enter any two numbers    ");
     number1 = myScanner.nextInt();
     number2 = myScanner.nextInt();
     sum = number1 + number2;
     System.out.println("The sum is " + sum);
     } 
     else if (choice == 2) {
      System.out.print("Enter any two numbers ");
      number1 = myScanner.nextInt();
      number2 = myScanner.nextInt();
      average = number1 + number2 / 2;
      System.out.println("The average is " + average);
     }
     else if (choice == 3) {
      System.out.print("Enter any two numbers ");
      number1 = myScanner.nextInt();
      number2 = myScanner.nextInt();
      if (number1 > number2) {
       largest = number1;
       }
       else {
       
       
        largest = number2;
       }
       System.out.println("The largest number is " +largest);
      }
      else if (choice == 4) {
       System.out.print("Enter any two numbers ");
      number1 = myScanner.nextInt();
      number2 = myScanner.nextInt();
      if(number1 < number2) {
       smallest = number1;
       }
       else {
        smallest = number2;
       }
       System.out.println("The smallest number is " +smallest);
      }
      
     
    } while (choice !=5);
    System.out.print("Thanks");
   }
 }

and never do their homework for them.

dont you think if he wants to go in graphics designer field y in the world he wants to learn java? all he want to do is do his homework.

no, he doesn't want to do his homework. He wants to laze around while others do it for him.

dont you think if he wants to go in graphics designer field y in the world he wants to learn java? all he want to do is do his homework.

It doesn't matter if he is interested in it or not. If his major requires a course of this nature, then he has to do it.

In the real world you can't just simply say "I don't like that part of my job so I simply won't do it."

That would be really great. Think about it. One of the workers in a construction company doesn't like to use screw drivers so he simply places a sticker that looks like a driven-in screwhead at every spot he was suppossed to place a screw. Then your house falls apart. But don't blame him he just simply wanted to get his work done and didn't like that part of the job.

Wonderful.

Edit:

Also, whether the major demands it or not is irrelevant. He took the course, he needs to either do the work or take the hit to his record by either failing or withdrawing. Cheating is not and never was the answer. It will catch up to you sooner or later.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.