Questions
For this project, you will create a program in C that will test the user’s proficiency...

For this project, you will create a program in C that will test the user’s proficiency at solving different types of math problems.   The program will be menu driven. The user will select either addition, subtraction, multiplication or division problems. The program will then display a problem, prompt the user for an answer and then check the answer displaying an appropriate message to the user whether their answer was correct or incorrect. The user will be allowed 3 tries at each problem. The program will also keep statistics on how many problems were answered correctly.

This week you will add functions to allow the user to select problems of varying degrees of difficulty and also keep statistics on number of correct answers vs. total number of problems attempted.

So now let’s add the code for the remaining functions:

We’ll start by inserting code to ask the user if they want to see problems that are easy, medium or difficult. We’ll do this by prompting them to enter ‘e’ for easy, ‘m’ for medium or ‘d’ for difficult and we’ll do this right after they have selected the type of problems they want. We will also add a validation loop that will check to see if they entered a correct response (e,m, or d).

Easy – problems using numbers 0 thru 10

Medium – problems 11 thru 100

Difficult – problems 100 – 1000

Here’s some code to get you started on the “difficulty level.”

if( difficultyLevel == 'E')

    {

                num1=rand()%10+1;

                 num2=rand()%10+1;

    }

   else

     if (difficultyLevel == 'M')

                {num1=rand()%100+1;

                 num2=rand()%100+1;

                }

   else

                 { num1=rand()%1000+1;

                 num2=rand()%1000+1;}           

Use an “if” statement to check the difficulty and generate the random numbers.

Statistics:

Create two variables ttlProblems and correctAnswers. Every time the user answers a problem add 1 to ttlProblems and every correct answer add 1 to correctAnswers. We’ll display the total number of problems and correct answers as well as the percent correct after the user has selected the exit option on the main menu.  

Then, alter the code to allow for floating point numbers. This requires formatting the output.

In: Computer Science

JAVA : Many games are played with dice, known as a die in the singular. A...

JAVA :

Many games are played with dice, known as a die in the singular. A die is a six-sided cube whose sides are labeled with one to six dots. The side that faces up indicates a die's face value.

Design and implement a Java class Die that represents one 6-sided die. You should be able to roll the die and discover its upper face. Thus, give the class the method int roll, which returns a random integer ranging from 1 to 6, and the method int getFaceValue, which returns the current face value of the die (last value rolled). Note a call to roll will return the same value as a subsequent call to getFaceValue.

Often, games depend on the roll of two dice. Using your class Die, design and implement a Java class TwoDice with an aggregation ("has-a") relationship to the Die class. An object of TwoDice represents two six-sided dice that are rolled together. Include at least the following TwoDice methods: int rollDice, int getFaceValue1, int getFaceValue2, int getValueOfDice (returns the sum of the two dice values), boolean isMatchingPair, boolean isSnakeEyes, andString toString.

Demonstrate your Die and TwoDice classes using the following test client:

public class Main
{
    public static void main(String[] args)
    {
        Die dieOne = new Die();
        Die dieTwo = new Die();
        Die dieThree = new Die();
        
        System.out.println("Demonstrating the Die class:");
        System.out.println("Rolling dieOne: " + dieOne.roll());
        System.out.println("Rolling dieTwo: " + dieTwo.roll());
        System.out.println("Rolling dieThree: " + dieThree.roll());
        
        TwoDice dice = new TwoDice();
        
        System.out.println("Demonstrating the TwoDice class: ");
        System.out.println("Rolling dice: [" + dice.getFaceValue1()
                + ", " + dice.getFaceValue2() + "]");
        
        dice.rollDice();
        System.out.println("Rolling dice: [" + dice.getFaceValue1()
                + ", " + dice.getFaceValue2() + "]");
        
        dice.rollDice();
        System.out.println("Rolling dice: [" + dice.getFaceValue1()
                + ", " + dice.getFaceValue2() + "]");

    }
}

In: Computer Science

Python Program 1: Write a program that takes user input in the form of a string...

Python Program 1:

Write a program that takes user input in the form of a string
Break up the string into a list of characters
Store the characters in a dictionary
The key of the dictionary is the character
The value of the dictionary is the count of times the letter appears
Hint: remember to initialize each key before using
Output of program is the count of each character/letter
Sort the output by key (which is the character)

Python Program 2:

Write a program that takes user input in the form a string
Break up the string into a list of characters
Store the characters in set
Use two sets to find the set of vowels in the user's string
Use two sets to find the set of consonants in the user's string
Hint: use a list of vowels and the intersection/difference functions
Output will be the set of vowels and set of consonants

In: Computer Science

c# language Write a program that takes in a number from the user. Then it prints...

c# language

Write a program that takes in a number from the user. Then it prints a statement telling the user if the number is even or odd. If the number is odd, it counts down from the number to 0 and prints the countdown on the screen, each number on a new line. If the number is even, it counts down from the number to 0, only even numbers. For example, if the user enters 5, the output will look like this:

The number you entered is odd.

5

4

3

2

1

0

If the user enters 6, the output will look like this:

The number you entered is even.

6

4

2

0

Submit your .c file. Also submit a screen shot of the terminal with the output displayed.

In: Computer Science

How did the Integrated Circuit impact the development of technology during the 1950’s and 60’s?

  1. How did the Integrated Circuit impact the development of technology during the 1950’s and 60’s?

In: Computer Science

(Write in PythonUse a for statement to print 10 random numbers between 25 and 35, inclusive....

(Write in PythonUse a for statement to print 10 random numbers between 25 and 35, inclusive.

(Write in Python)in python  The Pythagorean Theorem tells us that the length of the hypotenuse of a right triangle is related to the lengths of the other two sides. Look through the math module and see if you can find a function that will compute this relationship for you. Once you find it, write a short program to try it out.

(Write in PythonSearch on the internet for a way to calculate an approximation for pi. There are many that use simple arithmetic. Write a program to compute the approximation and then print that value as well as the value of math.pi from the math module.

In: Computer Science

The given plaintext is “Feistel cipher structure uses the same algorithm for both encryption and decryption”....

The given plaintext is “Feistel cipher structure uses the same algorithm for both encryption and decryption”. Write Java code to implement Shift cipher (Encryption and Decryption) and test your code on given plaintext. Your code must meet following conditions.

1. User must enter the value of key from command prompt and print it at command prompt.

2. Print the cipher text and the plaintext at the command prompt after encryption and decryption.

3. Test your algorithm for 5 different key values and please give screenshots of command prompt input and outputs.

In: Computer Science

Python #Note: use print() to add spaces between items and when needed in the receipt #(e.g....

Python

#Note: use print() to add spaces between items and when needed in the receipt
#(e.g. between user entries and between the entries and the receipt)

#1 Ask the user for a number using the prompt: NUMBER?
# Convert the user entered number to an integer
# Calculate the square of the number and display the result on screen with the following text before it: Your number squared is

#2 Ask the user for a first number using the prompt: first number?
# Ask the user for a second number using the prompt: second number?
# Convert the two numbers to integers
# Multiply the first number by the second number and display the result on screen with the following text before it: Result:
"""
#3 Develop a simple food receipt
a. Ask the user for inputs about two food items using the following prompts in turn. Do not forget to assign each user
entry to a unique variable name:
Item1 name?
Item1 price?
Item1 quantity?
  
Item2 name?
Item2 price?
Item2 quantity?
  
b. Convert the price and quantity variables to integers
c. Calculate the total cost for the order by calculating each item's total price by
multiplying price and quantity for each item and then adding up the total prices for the two items
d. Display the results using the format:
RECEIPT
You ordered: [item1 name] and [item2 name]
Total cost: $ [total price for both items calculated in 3c above]

"""
#Start your code below


Enhance your simple food receipt
a. Ask the user for inputs about two food items using the following prompts in turn. Do not forget to assign each user
entry to a unique variable name:
First item name?
First item price?
First item quantity?
  
Second item name?
Second item price?
Second item quantity?
  
Third item name?
Third item price?
Third item quantity?
  
b. Convert the price and quantity variables to integers
c. Calculate the total cost for the order by calculating each item's total price by
multiplying price and quantity for each item and then adding up the total prices for the three items
d. Calculate the total cost plus tax for the order by multiplying the total cose calculated in c by the tax rate of .09
then adding the tax to the total cost
e. Display the results using the format:
RECEIPT
You ordered: [First item name] [Second item name] [third item name]
Total cost: $ [total price for all items calculated in 3c above]
Total cost plus tax: $ {total cost plus tax calculated in 3d above}

"""
#Start your code below

In: Computer Science

For each case below, graphically represent entities and relationships between entities. Include primary keys, foreign keys...

For each case below, graphically represent entities and relationships between entities. Include primary keys, foreign keys where appropriate. For each entity add a couple of attributes (fields) and then provide a brief statement explaining why each entity (table) is in 3NF.

An online retailer of coffee beans maintains a long list of unique coffee flavors. The company purchases beans from a number of suppliers; however, each specific flavor of coffee is purchased from only a single supplier. Many of the customers are repeat purchasers and typically order at least five flavors of beans in each order.

In: Computer Science

In Assembly Code write an assembler code (Fibonacci.s) and show results The Fibonacci Sequence is a...

In Assembly Code

write an assembler code (Fibonacci.s) and show results

The Fibonacci Sequence is a series of integers. The first two numbers in the sequence are both 1; after that, each number is the sum of the preceding two numbers.

1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...

For example, 1+1=2, 1+2=3, 2+3=5, 3+5=8, etc.

The nth Fibonacci number is the nth number in this sequence, so for example fibonacci(1)=1, fibonacci(2)=1, fibonacci(3)=2, fibonacci(4)=3, etc. Do not use zero-based counting; fibonacci(4)is 3, not 5.

Your assignment is to write an assembler code (Fibonacci.s) that asks the user for the nth term in the Fibonacci sequence. Your program should then calculate the nth Fibonacci number and print it out.

For example, you program should produce the following outputs:

Enter Fibonacci term: 6

The 6th Fibonacci number is 8

In: Computer Science

Write a program that displays a frame containing two labels that display your name, one for...

Write a program that displays a frame containing two labels that display your name, one for your first name and one for your last. Experiment with the size of the window to see the labels change their orientation to each other.
USE FIRST NAME: Aya LAST NAME: KAYED.

SEND THE CODE IN THE EXACT FORMAT FOR JAVA ECLIPSE. I WILL COPY AND PASTE THE CODE SO I CAN RUN IT.

In: Computer Science

Starting Out with Python 4th ed., Page 104 Programming exercise #14 When a bank account pays...

Starting Out with Python 4th ed., Page 104 Programming exercise #14

When a bank account pays compound interest, it pays interest not only on the principal amount that was deposited into the account, but also on the interest that has accumulated over time. Suppose you want to deposit some money into a savings account, and let the account earn compound interest for a certain number of years. The formula for calculating the balance of the account after a specified number of years is:

?=?(1+??)??
A
=
P
(
1
+
r
n
)
n
t

The terms in the formula are:

A is the amount of money in the account after the specified number of years.
P is the principal amount that was originally deposited into the account.
r is the annual interest rate.
n is the number of times per year that the interest is compounded.
t is the specified number of years.
Write a program that makes the calculation for you. The program should ask the user to input the following:

The amount of principal originally deposited into the account
The annual interest rate paid by the account
The number of times per year that the interest is compounded (For example, if interest is compounded monthly, enter 12. If interest is compounded quarterly, enter 4.)
The number of years the account will be left to earn interest
Once the input data has been entered, the program should calculate and display the amount of money that will be in the account after the specified number of years.

All money should be limited to 2 decimal places.

Demo

Note: Bold text indicates user input

Enter principal: 1000
Enter rate: 9.5
Enter number of times per year interest is compunded: 4
Enter number of years: 7
Account balance: $1929.43
eof

In: Computer Science

Python #Note: use print() to add spaces between items and when needed in the receipt #(e.g....

Python

#Note: use print() to add spaces between items and when needed in the receipt
#(e.g. between user entries and between the entries and the receipt)

#1 Ask the user for a number using the prompt: NUMBER?
# Convert the user entered number to an integer
# Calculate the square of the number and display the result on screen with the following text before it: Your number squared is

#2 Ask the user for a first number using the prompt: first number?
# Ask the user for a second number using the prompt: second number?
# Convert the two numbers to integers
# Multiply the first number by the second number and display the result on screen with the following text before it: Result:
"""
#3 Develop a simple food receipt
a. Ask the user for inputs about two food items using the following prompts in turn. Do not forget to assign each user
entry to a unique variable name:
Item1 name?
Item1 price?
Item1 quantity?
  
Item2 name?
Item2 price?
Item2 quantity?
  
b. Convert the price and quantity variables to integers
c. Calculate the total cost for the order by calculating each item's total price by
multiplying price and quantity for each item and then adding up the total prices for the two items
d. Display the results using the format:
RECEIPT
You ordered: [item1 name] and [item2 name]
Total cost: $ [total price for both items calculated in 3c above]

"""
#Start your code below

"""
Enhance your simple food receipt
a. Ask the user for inputs about two food items using the following prompts in turn. Do not forget to assign each user
entry to a unique variable name:
First item name?
First item price?
First item quantity?
  
Second item name?
Second item price?
Second item quantity?
  
Third item name?
Third item price?
Third item quantity?
  
b. Convert the price and quantity variables to integers
c. Calculate the total cost for the order by calculating each item's total price by
multiplying price and quantity for each item and then adding up the total prices for the three items
d. Calculate the total cost plus tax for the order by multiplying the total cose calculated in c by the tax rate of .09
then adding the tax to the total cost
e. Display the results using the format:
RECEIPT
You ordered: [First item name] [Second item name] [third item name]
Total cost: $ [total price for all items calculated in 3c above]
Total cost plus tax: $ {total cost plus tax calculated in 3d above}

"""
#Start your code below

In: Computer Science

: This exercise will give you a review of Strings and String processing. Create a class...

: This exercise will give you a review of Strings and String processing. Create a class called MyString that has one String called word as its attribute and the following methods: Constructor that accepts a String argument and sets the attribute. Method permute that returns a permuted version of word. For this method, exchange random pairs of letters in the String. To get a good permutation, if the length of the String is n, then perform 2n swaps. Use this in an application called Jumble that prompts the user for a word and the required number of jumbled versions and prints the jumbled words. For example, Enter the word: mixed Enter the number of jumbled versions required: 10 xdmei eidmx miexd emdxi idexm demix xdemi ixdme eximd xemdi xdeim Notes: 1. It is tricky to swap two characters in a String. One way to accomplish this is to convert your String into an array of characters, swapping the characters in the array, converting it back to a String and returning it. char[] chars = word.toCharArray(); will convert a String word to a char array chars. String result = new String(chars); converts a char array chars into a String. p 6 2. Use Math.random to generate random numbers. (int)(n*Math.random()) generates a random number between 0 and n-1. java

In: Computer Science

Question 2 4-14 Which of the following terms best describes the following diagram? Question 2 options:...

Question 2

4-14 Which of the following terms best describes the following diagram?

Question 2 options:

DMZ

Intranet

Public LAN

Extranet

Question 3

4-13 Which of the following is the BEST definition of dual-homed?

Question 3 options:

Can filter on two OSI layers

Contains two NICs

Performs filtering and logging

Performs packet and content filtering

Question 4

4-10 Which of the following is the name for a lower-end (small business grade) firewall appliance that is capable of packet filtering, content filtering, intrusion detection, proxy, and application layer filtering?

Question 4 options:

UTM

All-in-one

SMB device

NGFW

Question 5

4-11 Which of the following is most often used for protecting a single computer?

Question 5 options:

hardware firewall

virtual firewall

software firewall

firewall appliance

Question 6

4-7 Which of the following were generation one firewalls capable of?

Question 6 options:

Filtering by IP header

Filtering by session layer header

Filtering by data content

Filtering by protocol being used

Question 7

4-6 the earliest firewalls were only capable of which of the following kinds of filtering?

Question 7 options:

Application layer

Stateless

Stateful

Circuit layer

Question 8

4-1 Which of the following were firewalls originally conceived to perform?

Question 8 options:

Block incoming unsolicited traffic

Block outgoing traffic

Both of the above

Neither of the above

Question 9

4-8 Which of the following is the word describing a firewall that is aware of a packet's place in an established and ongoing conversations

Question 9 options:

Content filter

Proxy

Stateless

Stateful

Question 10

4-20 Which of the following refers to a software firewall places on a dedicated server to create an internal hardware firewall?

Question 10 options:

Firewall system

Constructed firewall

Spare part firewall (SPF)

Virtual firewall

In: Computer Science