Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
image 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) Page

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 3 Lnai 8726

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448440, 978-3662448441

More Books

Students also viewed these Databases questions