- Write a menu driven program that will print out the results of the following : (1) Ceiling (2) Floor (3) Absolute (4) (a+b)^3 (5) Exit

(Accept a single input when user chooses options 1-3 and accept 2 inputs for option 4. Selecting 5 will end the program.

WAP a program to print this series : 2 3 4 5 6 7 2 3 4 5 6 2 3 4 5 2 3 4 2 3 2

Write a program that accepts a number and outputs the reverse of the number. (Use a While loop. Why do you need a while loop here and not a FOR loop?)

WAP that accepts salary and computes tax to be paid based on : 0 - 1 lac no tax

1 lac taxed at 25%

Input the name and marks of 25 students and compute the average. Print out the name and average of each student. (You can do this using an array or without using an array)

View Answers

December 29, 2011 at 1:20 PM

import java.util.*; class MenuDriven { public static void main(String[] args) { boolean exit=false; Scanner input=new Scanner(System.in); System.out.println("Enter Number: "); double num=input.nextDouble(); System.out.println("1 Ceiling"); System.out.println("2 Floor"); System.out.println("3 Absolute"); System.out.println("4 (a+b)^3"); System.out.println("5 Exit"); do{ System.out.print("Enter your choice: "); int choice=input.nextInt(); switch(choice){ case 1: System.out.println(Math.ceil(num)); break; case 2: System.out.println(Math.floor(num)); break; case 3: System.out.println(Math.abs(num)); break; case 4: break; case 5: exit=true; System.exit(0); break; } } while(!exit); } }

December 29, 2011 at 3:03 PM

**Java Reverse Number**

import java.util.*; public class ReverseNumber{ public static void main(String [] args){ Scanner input=new Scanner(System.in)); System.out.print("Enter number"); int num= inout.nextInt(); int n = num; int rev=0; System.out.println("Number: "); System.out.println(" "+ num); for (int i=0; i<=num; i++){ int r=num%10; num=num/10; rev=rev*10+r; i=0; } System.out.println("Reversed Number: "+ rev); } }

Ads

Related Tutorials/Questions & Answers:

compute B. Write a JavaScript program that would input Employee Name, Rate per hour, No. of hours worked and will compute the daily wage of an employee. If the number of hours worked exceeds eight hours add 30% to each excess

compute B. Write a JavaScript program that would input Employee Name, Rate per hour, No. of hours worked and will compute the daily wage... Name, Rate per hour, No. of hours worked and will compute the daily wage

Advertisements

compute Write a menu driven program that will print out the results of the following : (1) Ceiling (2) Floor (3) Absolute (4) (a+b)^3 (5) Exit... at 25% Input the name and marks of 25 students and compute the average. Print out

Compute command hello, What is compute command? hii, samar Compute command control computations on subsets created by the BREAK command

compute the average of degrees using c++ language , write a program to do the following 1 enter three degrees of a student by the user . 2 compute the average of his degrees

compute the daily wage of an employee. B. Write a JavaScript program that would input Employee Name, Rate per hour, No. of hours worked and will compute the daily wage of an employee. If the number of hours worked exceeds

compute the daily wage of an employee. B. Write a JavaScript... and will compute the daily wage of an employee. If the number of hours worked exceeds... and will compute the daily wage of an employee. If the number of hours worked

compute the final grades C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks

compute the final grades C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks

compute the final grades C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks

compute the final grades C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks

compute the final grades C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks

compute the final grades C. Write a JavaScript program that would input a student?s final grade from 50-100. Evaluate the Final grade and display the Point Equivalent based on the table below. Indicate also the remarks

compute nth root write a program that computes the nth root... Y, compute the nth root Z such that Z*Z*Z*Z*Z*Z*Z...(Y times)..Z*Z=X, or Z^y=X... and the program calculates Z. Compute Z so that when Z is multiplied Y time

Compute the image processing Hi, Question 1: I have some... code here to find the averaging of the image (grey image) also, How do i compute an average with a colour images one? Question 2: I need to compute

How to compute limit of ByteBuffer in java. In this tutorial, we... will compute the limit of buffer in write and read mode. In the writing mode

Java Swing Compute Factorial In this section, we are going to find the factorial of a given number. Here an user is allowed to enter a number into the text field whose factorial is to be determined. On pressing the button the value

Find sum of the squares of Array elements In this section, you will learn how to compute the sum of the squares of the array elements. For this, we have...: import java.util.*; class Compute { public static void main(String[] args

SQL Avg Syntax SQL Avg Syntax is used to compute the average of the records in a table. Understand with Example The Tutorial illustrate an example from 'SQL Average Syntax

JSP Array Length JSP Array Length is performed when you want to compute the length of array in JSP. Understand with Example The Tutorial

that is used to compute sum of the numeric field in a table. Understand... statement compute the sum of marks. The Group By Clause

SQL Avg Function SQL Avg Function is used to compute the average records value in a column of specified table. Understand with Example The Tutorial illustrate an example from

SQL Average SQL Average, the part of Aggregate Function. SQL Average is used to compute average value of the records in a table of the database. Understand

Draw a Flowchart This section illustrates you how to draw a Flowchart to compute the sum of first 50 natural numbers. To draw a flowchart, we have used

Operator Write a program to compute division of 2 without using any arithmetical oprerator.//[IT 3nd semester

method over riding write a java program to compute volume of sphere and volume of cylinder using method over riding