compute

compute

  1. 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.

  1. 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

  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?)

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

    1 lac taxed at 25%

  4. 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);  
  }
}









Related Tutorials/Questions & Answers:
compute
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
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
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
Compute command  hello, What is compute command?   hii, samarADS_TO_REPLACE_1 Compute command control computations on subsets created by the BREAK command
compute the average of degrees
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.
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.
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
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
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
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
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
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
ModuleNotFoundError: No module named 'compute-hyperv'
ModuleNotFoundError: No module named 'compute-hyperv'  Hi, My... named 'compute-hyperv' How to remove the ModuleNotFoundError: No module named 'compute-hyperv' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'numerai-compute'
ModuleNotFoundError: No module named 'numerai-compute'  Hi, My... named 'numerai-compute' How to remove the ModuleNotFoundError: No module named 'numerai-compute' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'civis-compute'
ModuleNotFoundError: No module named 'civis-compute'  Hi, My... 'civis-compute' How to remove the ModuleNotFoundError: No module named 'civis-compute' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'compute_gc'
ModuleNotFoundError: No module named 'compute_gc'  Hi, My Python... 'compute_gc' How to remove the ModuleNotFoundError: No module named 'compute_gc' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'compute-overtime'
ModuleNotFoundError: No module named 'compute-overtime'  Hi, My... named 'compute-overtime' How to remove the ModuleNotFoundError: No module named 'compute-overtime' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'infrasim-compute'
ModuleNotFoundError: No module named 'infrasim-compute'  Hi, My... named 'infrasim-compute' How to remove the ModuleNotFoundError: No module named 'infrasim-compute' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'compute-overtime'
ModuleNotFoundError: No module named 'compute-overtime'  Hi, My... named 'compute-overtime' How to remove the ModuleNotFoundError: No module named 'compute-overtime' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'numerai-compute'
ModuleNotFoundError: No module named 'numerai-compute'  Hi, My... named 'numerai-compute' How to remove the ModuleNotFoundError: No module named 'numerai-compute' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'compute-hyperv'
ModuleNotFoundError: No module named 'compute-hyperv'  Hi, My... named 'compute-hyperv' How to remove the ModuleNotFoundError: No module named 'compute-hyperv' error? Thanks   Hi, In your python
compute the final grades
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 - Java Beginners
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
ModuleNotFoundError: No module named 'larq-compute-engine'
ModuleNotFoundError: No module named 'larq-compute-engine'  Hi, My... named 'larq-compute-engine' How to remove the ModuleNotFoundError: No module named 'larq-compute-engine' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-tethys_compute'
ModuleNotFoundError: No module named 'django-tethys_compute'  Hi...: No module named 'django-tethys_compute' How to remove the ModuleNotFoundError: No module named 'django-tethys_compute' error? Thanks   Hi
ModuleNotFoundError: No module named 'azure-mgmt-compute'
ModuleNotFoundError: No module named 'azure-mgmt-compute'  Hi, My... named 'azure-mgmt-compute' How to remove the ModuleNotFoundError: No module named 'azure-mgmt-compute' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'azure-mgmt-compute'
ModuleNotFoundError: No module named 'azure-mgmt-compute'  Hi, My... named 'azure-mgmt-compute' How to remove the ModuleNotFoundError: No module named 'azure-mgmt-compute' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'google-compute-engine'
ModuleNotFoundError: No module named 'google-compute-engine'  Hi...: No module named 'google-compute-engine' How to remove the ModuleNotFoundError: No module named 'google-compute-engine' error? Thanks   Hi
ModuleNotFoundError: No module named 'rhg-compute-tools'
ModuleNotFoundError: No module named 'rhg-compute-tools'  Hi, My... named 'rhg-compute-tools' How to remove the ModuleNotFoundError: No module named 'rhg-compute-tools' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'azure-mgmt-compute'
ModuleNotFoundError: No module named 'azure-mgmt-compute'  Hi, My... named 'azure-mgmt-compute' How to remove the ModuleNotFoundError: No module named 'azure-mgmt-compute' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'google-compute-engine'
ModuleNotFoundError: No module named 'google-compute-engine'  Hi...: No module named 'google-compute-engine' How to remove the ModuleNotFoundError: No module named 'google-compute-engine' error? Thanks   Hi
Compute the image processing - Java Beginners
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
Maven Repository/Dependency: org.apache.jclouds | jclouds-compute
Maven Repository/Dependency of Group ID org.apache.jclouds and Artifact ID jclouds-compute. Latest version of org.apache.jclouds:jclouds-compute dependencies. # Version Release Date
ModuleNotFoundError: No module named 'odoo10-addon-hr-holidays-compute-days'
ModuleNotFoundError: No module named 'odoo10-addon-hr-holidays-compute-days...: ModuleNotFoundError: No module named 'odoo10-addon-hr-holidays-compute-days' How...-compute-days' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'odoo8-addon-account-compute-tax-amount'
ModuleNotFoundError: No module named 'odoo8-addon-account-compute-tax-amount...: ModuleNotFoundError: No module named 'odoo8-addon-account-compute-tax-amount' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-account-compute
ModuleNotFoundError: No module named 'odoo8-addon-account-compute-tax-amount'
ModuleNotFoundError: No module named 'odoo8-addon-account-compute-tax-amount...: ModuleNotFoundError: No module named 'odoo8-addon-account-compute-tax-amount' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-account-compute
ModuleNotFoundError: No module named 'odoo8-addon-stock-picking-compute-delivery-date'
ModuleNotFoundError: No module named 'odoo8-addon-stock-picking-compute...: ModuleNotFoundError: No module named 'odoo8-addon-stock-picking-compute-delivery...;odoo8-addon-stock-picking-compute-delivery-date' error? Thanks   Hi
ModuleNotFoundError: No module named 'odoo9-addon-hr-holidays-compute-days'
ModuleNotFoundError: No module named 'odoo9-addon-hr-holidays-compute-days...: ModuleNotFoundError: No module named 'odoo9-addon-hr-holidays-compute-days' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-hr-holidays-compute
ModuleNotFoundError: No module named 'odoo11-addon-hr-holidays-compute-days'
ModuleNotFoundError: No module named 'odoo11-addon-hr-holidays-compute-days...: ModuleNotFoundError: No module named 'odoo11-addon-hr-holidays-compute-days' How...-compute-days' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'odoo8-addon-hr-holidays-compute-days'
ModuleNotFoundError: No module named 'odoo8-addon-hr-holidays-compute-days...: ModuleNotFoundError: No module named 'odoo8-addon-hr-holidays-compute-days' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-hr-holidays-compute
How to compute limit of ByteBuffer in java.
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
com.google.apis - google-api-services-compute version alpha-rev20230322-2.0.0 Maven dependency. How to use google-api-services-compute version alpha-rev20230322-2.0.0 in pom.xml?
-compute Maven dependency? How to use  com.google.apis  - Version alpha-rev20230322-2.0.0 of google-api-services-compute in pom.xml? How to use google-api-services-compute version alpha-rev20230322-2.0.0 in pom.xml? Learn to use
com.google.apis - google-api-services-compute version v1-rev20230210-2.0.0 Maven dependency. How to use google-api-services-compute version v1-rev20230210-2.0.0 in pom.xml?
-compute Maven dependency? How to use  com.google.apis  - Version v1-rev20230210-2.0.0 of google-api-services-compute in pom.xml? How to use google-api-services-compute version v1-rev20230210-2.0.0 in pom.xml? Learn to use
com.google.apis - google-api-services-compute version v1-rev20230210-2.0.0 Maven dependency. How to use google-api-services-compute version v1-rev20230210-2.0.0 in pom.xml?
-compute Maven dependency? How to use  com.google.apis  - Version v1-rev20230210-2.0.0 of google-api-services-compute in pom.xml? How to use google-api-services-compute version v1-rev20230210-2.0.0 in pom.xml? Learn to use
com.google.apis - google-api-services-compute version beta-rev20230403-2.0.0 Maven dependency. How to use google-api-services-compute version beta-rev20230403-2.0.0 in pom.xml?
-compute Maven dependency? How to use  com.google.apis  - Version beta-rev20230403-2.0.0 of google-api-services-compute in pom.xml? How to use google-api-services-compute version beta-rev20230403-2.0.0 in pom.xml? Learn to use
com.google.apis - google-api-services-compute version beta-rev20230403-2.0.0 Maven dependency. How to use google-api-services-compute version beta-rev20230403-2.0.0 in pom.xml?
-compute Maven dependency? How to use  com.google.apis  - Version beta-rev20230403-2.0.0 of google-api-services-compute in pom.xml? How to use google-api-services-compute version beta-rev20230403-2.0.0 in pom.xml? Learn to use
com.google.apis - google-api-services-compute version beta-rev20230307-2.0.0 Maven dependency. How to use google-api-services-compute version beta-rev20230307-2.0.0 in pom.xml?
-compute Maven dependency? How to use  com.google.apis  - Version beta-rev20230307-2.0.0 of google-api-services-compute in pom.xml? How to use google-api-services-compute version beta-rev20230307-2.0.0 in pom.xml? Learn to use
Maven dependency for org.apache.jclouds - jclouds-compute version 2.3.0 is released. Learn to use jclouds-compute version 2.3.0 in Maven based Java projects
-compute released The developers of   org.apache.jclouds - jclouds-compute project have released the latest version of this library on 28 Feb 2021, the released version of  org.apache.jclouds - jclouds-compute library
Maven dependency for org.apache.jclouds - jclouds-compute version 2.5.0 is released. Learn to use jclouds-compute version 2.5.0 in Maven based Java projects
-compute released The developers of   org.apache.jclouds - jclouds-compute project have released the latest version of this library on 20 Mar 2022, the released version of  org.apache.jclouds - jclouds-compute library
Maven dependency for org.apache.jclouds - jclouds-compute version 2.5.0 is released. Learn to use jclouds-compute version 2.5.0 in Maven based Java projects
-compute released The developers of   org.apache.jclouds - jclouds-compute project have released the latest version of this library on 20 Mar 2022, the released version of  org.apache.jclouds - jclouds-compute library

Ads