Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sample output is given below. Your output must look exactly like this output. -Must not import java classes -Must use ToString, printInfo, Constructor(s), setters and

Sample output is given below. Your output must look exactly like this output.

-Must not import java classes

-Must use ToString, printInfo, Constructor(s), setters and getters

image text in transcribedimage text in transcribed

Problems Implement the class HW2. The class will contain these structural elements and functionality. Sample output is given below. Your output must look exactly like this output Structure: Properties One private property of type char logicSelection, the user's currently selected logical operation. .One private property of type int total, the total number of operations performed. Each time any operation is selected, increment the counter keeping track of the total number of all the operations the user has performed Structure: Methods The elements/list of methods we include in every class. The method printMenu(): this method prints the menu of available operations. Note, the method does not handle receiving a user selection, it merely displays menu information. The method makelogicSelection(char logicSelection): this method set the logic selection to either 'a'/'A' for the logical AND [ && 1or 'b'B' for the logical OR [1I 1. In your solution, ensure the user has selected a valid option [either (a) or (b)]. If not, print an error message and do not modify the previous selection made. The method performLogic(boolean operand1, boolean operand2, boolean negation): the method will receive two boolean values and calculate the result of the two boolean values when used with the selected logical operator [either AND or OR]. If true is passed in as the negation parameter, then a logical negation will precede the entire logical operation. The method printTruthTable(): this method will print the truth table of the selected operation. For example, if Logical AND has been selected, print the entire truth table of the logical AND. The method moduloRangefint modValue): this method will print the remainder range possible from a given modValue. Output When calling each method [right clicking on the method in BlueJ] here is the output produced by each method: Output When calling each method right clicking on the method in Bluel] here is the output produced by each method: Operation Menu Logic Selections: (a) Logical AND (&6) (b) Logical OR (IID Methods: Make Logic Selection Modulo Range Perform Logic Print Truth Table Perform Logic Operation #1 Logic Selection: a Operand 1: Operand #2: Negation: true true false (true && true) yields true Operation 2 Logic Selection: a Operand $1: Operand #2: Negation: true false true ! (true && false) yields true /... and so on Print Truth Table ope ration #3 AB(A&&B)

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_2

Step: 3

blur-text-image_3

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

Rules In Database Systems Third International Workshop Rids 97 Sk Vde Sweden June 26 28 1997 Proceedings Lncs 1312

Authors: Andreas Geppert ,Mikael Berndtsson

1997th Edition

3540635165, 978-3540635161

More Books

Students also viewed these Databases questions

Question

Make effective use of recognition to motivate others.

Answered: 1 week ago