Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment will have two parts -- the first part is an exercise in exploring the Math class, and the second part will focus on

This assignment will have two parts -- the first part is an exercise in exploring the Math class, and the second part will focus on using the String class, both from the Java API 8.

Part 1: Modify your Calculator.java with Math class method(s) Locate the Math class in the Java API (version 8 ) like we saw in the relevant video by searching for Java API in your favorite search engine. Read through the various methods provided for the Math class in the Java API. You will use at least one of the methods to modify your Calculator.java from the Section 3 Activity. Make a copy of your Calculator.java and rename the copy CalcMath.java. Rename the class to CalcMath in your new CalcMath.java file. Remember that public classes must have the same file name. Modify your CalcMath to add a calculation task based on at least one of the methods available to you in the Java API Be creative but FIRST write down a plan with pencil on paper. Don't start coding right away. How can you introduce this new calculator function in your existing calculator that already allows the user to do basic math? Once you have a plan written down, add code that will ask the user if they want to do the specific calculation you've added ask for numbers needed (can re-use the existing code, if needed) print the result Once finished, your program should do everything asked for in Activity 3 plus calculate using the new Math method, plus give the user the option to choose another calculation. Take a screenshot of your code and the output of at least two consecutive calculations in one running of the program. Insert the screenshot(s) into a word processing document named S05API with your last name and first initial, e.g. S05APISmithD. Complete part 2 of this assignment.

Part 2: Practice the usage of a few common (and important!) pre-built methods from the String class in the Java API. Locate the String class in the Java API (version 8 since we're using the version 8 of the JDK) like we saw in the relevant video by searching for Java API in your favorite search engine. Scroll down to the String class. Read through the various methods provided for the String class in the Java API. You will use some of the methods in this exercise. Create a small Java program with the .java extension to include: a class named StringPractice a main() method three (3) String variables: state1, with a value of California state2, with a value of california city, with a value of Rancho Santa Margarita In the main() method, call the following methods from the pre-built String class and output the results equals() <- use state1 and state2 variables compareTo() <- use state1 and state2 variables length() <- use city variable indexOf() <- use the city variable to output the location of a character or set of characters substring() <- use the city variable to output a character or set of characters toUpperCase() <- use state2 variable Take a screenshot of your code and the output. Insert the screenshot(s) into your S05API document. Save/download/export as your S05API document to a pdf file. Submit the S05API pdf to this assignment dropbox.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

is extranet an outside, inside, or dmz zone

Answered: 1 week ago