Question

In: Computer Science

8.   Create a truth table and determine the results for the following equation and values Equation :...

8.   Create a truth table and determine the results for the following equation and values

Equation : bool b = ((a+4< 7) || ((b-a > 10) && !(c*a == 8)))

Values :   a = 2; b = 8; c = 4

9. Write a program using Atom and submit via Blackboard.

a. Request an integer whole dollar amount from the console.

b. Using the least amount of bills ($50,$20,$10,$5,$1) necessary, calculate how many of each bill type you will need to get to that value.

Output Example 1 (input is bold and italicized)

Enter a whole dollar amount as n integer: 633                                                           

You will need:

12   $50 bill(s).

1   $20 bill(s).

1 $10 bill(s).

0   $5 bills(s).

3    $1 bill(s).

Output Example 2 (input is bold and italicized)

Enter a whole dollar amount as an integer: 364                                                        

You will need:

7     $50 bill(s).

0     $20 bill(s).

1   $1 bill(s).

0     $5 bills(s).

4     $1 bills(s).

Solutions

Expert Solution

8) lets derive the expression part by part...

a=2;b=8;c=4;

a+4<7 => 6<7 => true

b-a > 10 =>8-2 > 10 => 6 > 10 => false

!(c*a==8) => !(4*2==8) => !(8==8) => !(true) => false

therefore the total expression comes : (true || (false && false)) =>( true || false) => true

therefpre,b=true;

9) As you have not mentioned the language, i am writing the code in java in a very simple way...

if you have any doubt, please ask me in the comment box...

code...

import java.util.*;
public class bill{
        public static void main(String args[]){
                int n;
                Scanner in = new Scanner(System.in);   //creating scanner object
                System.out.print("Enter a while dollar amount as n integer : ");
                n=in.nextInt();    //taking input say 633
                System.out.println("you will need :");
                System.out.println(n/50+"   $50 bill(s).");     //total $50 bill required is 633/50=12
                n=n%50;      // finding the rimainder i.e. for 633 it is 33 
                System.out.println(n/20+"   $20 bill(s).");    // then total $20 bill required is 33/20=1 
                n=n%20;       //now remainder is 33%20=13
                System.out.println(n/10+"   $10 bill(s).");   // total number of $10 bill required is 13/10=1
                n=n%10;        //now the n value is 13%10=3
                System.out.println(n/5+"   $5 bill(s).");   // total number of $5 bill required is 3/5=0
                n=n%5;    // now the value of n is 3%5=3
                System.out.println(n+"   $1 bill(s).");    //so finally $1 bill required is n
                }  //end  of main
        }  //end of class

I have done the code with one example... hope you will understand...

output...


Related Solutions

The results of a standard Proctor test are given in the following table. a) Determine the...
The results of a standard Proctor test are given in the following table. a) Determine the maximum dry unit weight of compaction and the optimum moisture content. Given: Mold volume = 1/30 ft3. b) Determine the void ratio and the degree of saturation at the optimum moisture content. Given: Gs = 2.69. Trial no. Weight of moist soil in the mold (lb) Moisture content (%) 1 3.7 8.6 2 4.15 10.6 3 4.69 12.5 4 4.62 14.9 5 4.02 16.7...
create a VHDL program for the Truth Table below. Please make sure to create your code...
create a VHDL program for the Truth Table below. Please make sure to create your code for the simplified circuit. A B C Z 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0
Q2) (a) construct a truth table for the following function: ?(?, ?, ?) = (?? +...
Q2) (a) construct a truth table for the following function: ?(?, ?, ?) = (?? + ?̅?) ̅̅̅ + ?? (b) Use the truth table of (a) to write the function F in sum of minterms form. (c) Expand the function ?(?, ?, ?) = ? + ?̅? to product of Maxterms form. (d) Simplify the following function using K-Map. ?(?, , ?, ?, ?) = ?̅? + ?? + ?̅? + ??̅?
8. Given the following table of x and y values, test the claim that there is...
8. Given the following table of x and y values, test the claim that there is a significant linear correlation. Use a .05 significance level. You do not have to find an equation. x|    12    10        9      7       8 y| 175    169   182   146   144
Create a decision table that describes the ORDER process. Simplify the table you create and describe the results.
Task 1: Fresh-Mart GroceryFresh-Mart Grocery is a regional grocery chain that is developing an information system to monitor product sales and inventory levels. As products are sold in stores, they need to be replaced by shipments from the distribution centers. The IT manager wants you to document the automatic ordering process called “ORDER” which determines whether to order or not. The process works as follows:Whenever a sale transaction takes place, the system checks if product inventory is left at the...
Create two arguments, one valid and one invalid. Demonstrate with a truth table the validity of...
Create two arguments, one valid and one invalid. Demonstrate with a truth table the validity of each
create two arguments, one valid and one invalid. Demonstrate with a truth table the validity of...
create two arguments, one valid and one invalid. Demonstrate with a truth table the validity of each.
Design an 8-bit adder. Show the truth table, logic circuit, and Verilog code.
Design an 8-bit adder. Show the truth table, logic circuit, and Verilog code.
Design an 8-bit adder. Show the truth table, logic circuit, and Verilog code.
Design an 8-bit adder. Show the truth table, logic circuit, and Verilog code.
Using a truth table determine whether the argument form is valid or invalid p ∧ q...
Using a truth table determine whether the argument form is valid or invalid p ∧ q →∼ r p∨∼q ∼q→p ∴∼ r
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT