Question: 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
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 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
Get step-by-step solutions from verified subject matter experts
