Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a menu application that will perform the following tasks: [15 points] Task 1: it consists of writing a method, nextMultipleOfTen(), that returns

image text in transcribedimage text in transcribed

1. Write a menu application that will perform the following tasks: [15 points] Task 1: it consists of writing a method, nextMultipleOfTen(), that returns the next multiple of 10 to a given number. If the entered number by the user is negative, your program should print the message "Input Error! Enter a Positive Value". For example: For -25, the program should print "Input Error! Enter a Positive Value". O O For 90, the program should print 100. O For 92, the program should print 100. O For 98, the program should print 100. [25 points] Task 2: Write a method, isCrazy(), that tests whether a given number is crazy. A crazy number is a number satisfying two conditions: O Condition 1: it should be a positive number (0 is not included). O Condition 2: its left-most digit should be greater than or equal to 5. [10 points] Main method to test your application as given in the following samples of input/output. Samples of Input / Output are below. Press 1 for Task 1, 2 for Task 2 Your Choice? 1 Enter a number: -25 Input Error! Enter a Positive Value. Press 1 for Task 1, 2 for Task 2 Your Choice? 1 Enter a number: 92 Next multiple of 10 to 92 is 100. Press 1 for Task 1, 2 for Task 2 Your Choice? 2 Enter a number: -84 -84 is not a crazy number Press 1 for Task 1, 2 for Task 2 Your Choice? 2 Enter a number: 84 84 is a crazy number Press 1 for Task 1, 2 for Task 2 Your Choice? 2 Enter a number: 48 48 is not a crazy number Press 1 for Task 1, 2 for Task 2 Your Choice? 5 Input Error! Try Again Later [25 points] Write a method with the following header to return an integer reversed: public static int reverse(int number) For example, System.out.prinltn( reverse(3456)); displays 6543. [15 points] Write the methods with the following headers // Return true if number is a palindrome public static boolean isPalindrome(int number) P.S. Use the reverse method to implement isPalindrome. A number is a palindrome if its reversal is the same as itself. [10 points] Main method to test your application as given in the following samples of input/output. run: Enter a number: 23532 in reverse 23532 is: 23532 23532 is palindrome BUILD SUCCESSFUL (total time: 3 seconds) Output - CSCI250LFinalExam3 (run) run: Enter a number: 65352 in reverse 65352 is: 25356 65352 is NOT palindrome BUILD SUCCESSFUL (total time: 7 seconds)

Step by Step Solution

3.30 Rating (147 Votes )

There are 3 Steps involved in it

Step: 1

import javautilScanner public class Main public static void mainString args S... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Quantitative Analysis for Management

Authors: Barry Render, Ralph M. Stair, Michael E. Hanna, Trevor S. Ha

12th edition

133507335, 978-0133507331

More Books

Students also viewed these Programming questions