Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the language of Java please CSSSKL 142 Lab 3 Boolean expressions, if statements and more methods Create a class Lab3 and put everything in
In the language of Java please
CSSSKL 142 Lab 3 Boolean expressions, if statements and more methods Create a class Lab3 and put everything in it or use the provided template: Lab3a.java D, Lab3b.java , and Lab3c.java Part 1 1. In this exercise you will write a method that takes a single argument, an integer, and prints the number passed in and whether or not it is even or odd. This method is named oddEvenChecker , and should work as follows: oddEvenChecker (3); // Should print "3 is an odd number". oddEvenChecker (8); // Should print "8 is an even number" To do this exercise it is helpful to know about the modulo operator, represented in Java by the symbol %. Modulo returns the remainder of the number in front of it divided by the number behind it - so for example, the value of the expression 7%3 is 1 (because 7 divided by 3 is 2 with a remainder of 1). 2. Now implement another method, multipleOfChecker that takes two arguments, both integers. It then prints whether or not the first number is a multiple of the second number. For instance: multipleOfChecker (16 , 4); // Should Print "16 is a multiple of 4" multipleOfChecker (11 , 3); // Should Print "11 is not a multiple of 3" You should test your methods in main using various combinations of inputs to rule out any logical bugs. Part 2 In this exercise you will write a method that takes a Scanner object from main and uses it to ask the user to input two doubles using the keyboard, sums their square roots, and prints a statement based on what bucket the result is in. The possible buckets are "Less than 10", "Between 10 and 20", "Between 20 and 30", and "Greater than 30." Negative numbers should be rejected with the appropriate message printed to the user. The method is named sqrtSumBucketer , and it should work as follows: If user enters 23 and 16, then sqrtSumBucketer ( input ); // Should print " Less than 10" If user enters 2 and 999, then sqrtSumBucketer ( input ); // Should print " Greater than 30.". Part 3 Boolean Expressions Using pen and paper, figure out the truth-value of the following boolean expressions. Then put the following code in your lahz's main and run it to check your answers You will have to use nrint statements to check Beclean Expressions Using pen and paper,gure out the truth value of the following been ressions. Then put the following code in your Labs-andrunitosteck your answers. You will have to be print statements teche them. Please upload a picture of your hand boolean Fiveless .5 15 int - 4 booleon is ve - ( 2 ): boolean isOdd ! (istven): boolean istenLessoriaal- 10 int a int h - 5: boolean SALGS - asb 10/10): Part 4 1. We amorhadthat takes in tamainput and turn the g rof the value Ulike in lah2, NOTU N byrinthatha Mama Machin 2. Write a method that takes the distr ess and r e st of the three values Unlike inlab 2. you are NOT alowed to be any brary unions in the such as Mathumaxor Machin. Hinterested statements Part 5 Forthehnal part of the it, we wil ask you to create a versione rack paperscher game. This program will take a user Input of, 1, or 2, which representi per orchers respectively. You will then annat arawom number for the computer banna and 2. The d ipint the winner of the 1. Create a method calcd intTalord which takes as an argument an integer. Using a switch, return mack" If the argument is a paper for land for internat. 1. or 2 privinvald s on" 2. CARA method Findinner who takes armatswo c amid determines the winner Itsidreturnere of three strings: "Tie- "scopChoice beats userChoices. I win." "userChoice beats conChoice. You win.' 3 File the main methods that user m.stche mber, then the comer and e re a number been and 2 and then on of the the long rings are by calling the methods You wote prerogly "You chose auserChoices. I choose corpChoices, winners beats closers, wirner , "You chose userChoices. I choose corphic. Tie." 2.9. "You chose rock. I chose paper. paper beats rack. I win." e. "You chose poper. I chose paper. The You c an check our bets rock You winStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started