Question: This is correct but it also needs to do is like if user enter (p&q)->r then it print out the truth table I need java
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
Get step-by-step solutions from verified subject matter experts
