Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The java code suppose to do this what it also suppose to print truth table like say if user enter in the input (p and

image text in transcribedThe java code suppose to do this what it also suppose to print truth table like say if user enter in the input (p and q) or r. This is just example of what program will do it suppose take whatever proposition he enter then print the truth table. for example It suppose to take this user information and print the table for each p and q. Then it suppose to take p and q or r and print the truth table. The question is that can give me java source code for that.
5:50 class Truth Tablemain elass named Truth Table. public statie void main Suingl argsmetod named input. inc-onif user eniers lessthan 0 then message is printed Syslem exilOand peogram is lerminated the peepositions eniered by user for(int i.acn;i++) boolcan truth Tae-nw truth Table array of type boolcam to slore truth values boolcan by position ie8421 o int- valuesil value-1)2fills the aray with oomogonding docima this loop processes and fils the array with truth valucs orint i nt sum- k0sm is assigned with the valuc of i and&to O & is uned to traverse the array from 0 as j is starting from s-1 valueif sum valuc is lessthan vall truthTablek+-tuc//truc is storod and k is incrmntiod truuhTablli-alseolielse false is storod andk is incromentiol this loop prints the propositions this loop prints the truth Tabl uthTable Wif truth value is trug then System out printt TT is printed else System.out printt Fess Fis printied :\html>java TruthTable nter the number of Propositional: 3 5:50 class Truth Tablemain elass named Truth Table. public statie void main Suingl argsmetod named input. inc-onif user eniers lessthan 0 then message is printed Syslem exilOand peogram is lerminated the peepositions eniered by user for(int i.acn;i++) boolcan truth Tae-nw truth Table array of type boolcam to slore truth values boolcan by position ie8421 o int- valuesil value-1)2fills the aray with oomogonding docima this loop processes and fils the array with truth valucs orint i nt sum- k0sm is assigned with the valuc of i and&to O & is uned to traverse the array from 0 as j is starting from s-1 valueif sum valuc is lessthan vall truthTablek+-tuc//truc is storod and k is incrmntiod truuhTablli-alseolielse false is storod andk is incromentiol this loop prints the propositions this loop prints the truth Tabl uthTable Wif truth value is trug then System out printt TT is printed else System.out printt Fess Fis printied :\html>java TruthTable nter the number of Propositional: 3

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

a. When did your ancestors come to the United States?

Answered: 1 week ago

Question

d. What language(s) did they speak?

Answered: 1 week ago

Question

e. What difficulties did they encounter?

Answered: 1 week ago