Questions
Write a program that uses nested loops to collect data and calculate the average rainfall over...

Write a program that uses nested loops to collect data and calculate the average rainfall over a period of years. The program should first ask for the number of years. The outer loop will iterate once for each year. The inner loop will iterate 12 times, once for each month. Each iteration of the inner loop will ask the user for the inches of rainfall for that month.

After all iterations, the program should display the number of months, the total inches of rainfall, and the average rainfall per month for the entire period.

Input Validation: Do not accept a number less than 1 for the number of years. Do not accept negative numbers for the monthly rainfall.

Please post the program working as well. Thank you

In: Computer Science

A painting company has determined that for every 110 square feet of wall space, one gallon...

A painting company has determined that for every 110 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $25.00 per hour for labor. Write a modular program that allows the user to enter the number of rooms that are to be painted and the price of the paint per gallon. It should also ask for the square feet of wall space in each room.

It should then display the following data:

  • The number of gallons of paint required
  • The hours of labor required
  • The cost of the paint
  • The labor charges
  • The total cost of the paint job

Input validation: Do not accept a value less than 1 for the number of rooms. Do not accept a value less than $10.00 for the price of paint. Do not accept a negative value for square footage of wall space.

In: Computer Science

just anwser .the question, so that I can finish the essay [10 marks] Given the following...

just anwser .the question, so that I can finish the essay

[10 marks] Given the following article in Computer Technology:

We can’t trust AI systems built on deep learning alone

Gary Marcus, a leader in the field, discusses how we could achieve general intelligence— and why that might make machines safer.

by Karen Hao Sep 27, 2019

https://www.technologyreview.com/s/614443/we-cant-trust-ai-systems-built-on-deeplearning-alone/

INSTRUCTIONS: Answer the following questions in an essay:

1. What are the value and descriptive assumptions? [4 marks]

2. Is/Are there any fallacy/fallacies in the reasoning? [4 marks]

3. What kind of evidence is provided and how good is it? [2 marks]


go into the link,read and anwser the question

In: Computer Science

C++ Code ***User Interface Write a program that offers an easy way to add items, remove...

C++ Code

***User Interface

Write a program that offers an easy way to add items, remove the last item, look at the last item put in the list. You will write all of the code for processing the stack - do not use any predefined objects in C++.  You decide how the interface will look. A menu driven program is always a good choice.

***Rules for program***

  • NEVER use break, exit, return, pass, continue or anything to leave a loop (or iteration), function, or other construct prematurely, unless it is part of the structure as in a case statement.
  • NEVER use global variables. However, you may use global constants if it is appropriate and they are used properly.
  • Should only have only one return statement in a function. (Exception – Multiple return statements may be necessary in a recursive function.)

****PLEASE READ**** Additional information for program below.

Write a program to keep up with a collection of "Item" objects. ( Please put comments on all functions other than main to describe purpose)

create a class “Item” with the following private data attributes:

  • Item name (string)
  • Color (string)

For this lab have separate files in a project. Put your class definitions in header files and the implementations of the methods in a .cpp file.

You will have the following public methods:

  • Accessors and mutators for each attribute
  • Constructor that initializes the attributes to nulls (empty string)

Create another class to implement a stack of "Items" using an array-based implementation.

Your stack class should include the following operations:

  1. isEmpty – tell whether there are any entries in the stack
  2. push – add another item
  3. pop – remove the top item
  4. peek – look at the item on top
  5. display - displays the items in the stack indicating where the top is (this one just gives and easy way for me to see what is in the stack as I test your program)

In: Computer Science

Write a java code that first discards as many whitespace characters as necessary until the first...

Write a java code that first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value.

The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function.

If the first sequence of non-whitespace characters in str is not a valid integral number, or if no such sequence exists because either str is empty or it contains only whitespace characters, no conversion is performed.

If no valid conversion could be performed, a zero value is returned.

Example 1:

Input: "42"

Output: 42

Example 2:

Input: "   -42"

Output: -42

Explanation: The first non-whitespace character is '-', which is the minus sign. Then take as many numerical digits as possible, which gets 42.

Example 3:

Input: "4193 with words"

Output: 4193

Explanation: Conversion stops at digit '3' as the next character is not a numerical digit.

Example 4:

Input: "words and 987"

Output: 0

Explanation: The first non-whitespace character is 'w', which is not a numerical digit or a +/- sign. Therefore no valid conversion could be performed.

Note 1: When you are testing your code, drop the " around the input values.

Note 2: In this project, you should use the String methods you have learned in this class and implement a loop structure.  

In: Computer Science

1) Two of the major challenges business users face when using big data are finding the...

1) Two of the major challenges business users face when using big data are finding the information they need to make decisions and knowing that the data they have is valid.

(TRUE OR FALSE)

2) In microsoft access, Carlos is working with an existing database, but he wants to eliminate some of the columns in the table to create a new, more streamlined database. He will use projection to create his new database.​

(TRUE OR FALSE)

3) A virtual private network (VPN) supports a secure, encrypted connection between a company's employees and remote users through a third-party service provider.

(TRUE OR FALSE)

4) A client is any computer on a network that sends messages requesting services from the servers on the network.

(TRUE OR FALSE)

5) JavaScript can be used to validate data entry in a Web form.

(TRUE OR FALSE

In: Computer Science

Create 3 Classes per the following instructions: 1) Create an abstract parent superclass called MobileDevices and...

Create 3 Classes per the following instructions:

1) Create an abstract parent superclass called MobileDevices and include only the attributes that are common to both cellphones and tablets like iPads. Also create at least one abstract method.

2) Create a child class that extends the MobileDevices class called DeviceType that has attributes and methods regarding the type of device.

3) Create a third class that extends the DeviceType class called DeviceBrand that has attributes and methods for both Apple and Android devices. Make sure to create methods that override any methods in the superclass and possibly any parent class.

4) Create a driver class that initializes the classes and prints out values. Submit you .java files with your name appended to the file names and screenshots of your output.

In: Computer Science

Using Jeliot, execute the following algorithm which implements a buffer pool algorithm. The algorithm offers options...

Using Jeliot, execute the following algorithm which implements a buffer pool algorithm. The algorithm offers options for three different heuristics including LRU, LFU, and FIFO.

In: Computer Science

Caches are important to providing a high performance memory hierarchy to processors. Below is a list...

Caches are important to providing a high performance memory hierarchy to processors. Below is a list of 32-bit memory address references, given as word addresses. 6, 214, 175, 149, 214, 6 Given a direct-mapped cache with four-word blocks and a total size of 16 blocks. Please fill in the following table. You may assume that the cache is initially empty. Because the given address is word address, we may compute tags and indices based on word address. Four-word blocks indicate the right most 2 bits are offset in a block. 16 blocks indicates there are 4 bits for indices, and the rest 26 bits will be the tag.

Word address Binary Tag (hex) Index (Hex) Hit/Miss

6

214

175

149

214

6

In: Computer Science

I want to write java program to implement the indexing concept so as an example we...

I want to write java program to implement the indexing concept

so as an example we have file named Students this file contains information like this

112233445 ahmed

222442211 saeed

112453345 john

this program should search for the student name by its number so as an output example:

enter the student number

112233445

name found : ahmed

also i want to print the index number of where does the student name exists

In: Computer Science

Twenty One This game is similar to the famous card game blackjack. We will play a...

Twenty One

This game is similar to the famous card game blackjack. We will play a one-player version of the game. The game is played for some number N of rounds (we will use N = 10,000), at the end of which the player wins points. The player accumulates points during the whole game, and the objective is, of course, to end up with the maximum number of points.

The objective in each round of the game is to score as close to 21 as possible by rolling a die as many times as you wish and adding all the numbers that appear. When a player's total exceeds 21, he is 'busted' and gets 0 points. If the player chooses to stop rolling before he exceeds 21, then he wins whatever his total is at that point. So for example, if a player rolls 5, 2, 4, and then 6, his total at that point is 17, and he has to decide whether it is worth trying again: he will be busted if he gets 5 or more (since 17+5=22), but will get a better total if he gets 4 or less.

There are many variations on this game, some involving multiple players, or a "banker" or different numbers of dice, or alcohol..... here is a short YT video explaining the basic game.

A computer can play this game with a suitable strategy. For this problem, we will consider a strategy to be simply an integer K which is the value at which you stop rolling (thinking that you are close enough to 21). The number K is fixed for the entire game. For example, if you set K = 19, then in every round, you will keep rolling if your sum to that point is less than 19; if you get a num ≥ 19 you stop. Clearly, any good strategy will be a number at least 15, since 15+6=21 and if you roll again at 15, you will never bust. But we will try all possible strategies.

QUESTION: in python

You should write a function playRound(K) which rolls a single die until you reach or exceed K or get busted, and either return your score (if you reached or exceeded K), or 0 (if you were busted). Then write a function playGame() which calls playRound(K) for N = 10,000 times for each K and returns an array of 21 numbers giving the average payoff for each K = 1, ..., 21.

Your task is to answer the following questions:

  • For each K = 1 .. 21, what is the average payoff per round for a game played with this strategy?

  • What is the best strategy for the game, meaning what value of K wins the most points on average?

Print out the values and an appropriate bar chart for the first question, and simply print out the answer to the second question using a print(...) function.

In: Computer Science

Design an algorithm to prompt user to enter a number. Determine the number is odd or...

Design an algorithm to prompt user to enter a number. Determine the number is odd or even with Case Logic.

In: Computer Science

Twenty One This game is similar to the famous card game blackjack. We will play a...

Twenty One

This game is similar to the famous card game blackjack. We will play a one-player version of the game. The game is played for some number N of rounds (we will use N = 10,000), at the end of which the player wins points. The player accumulates points during the whole game, and the objective is, of course, to end up with the maximum number of points.

The objective in each round of the game is to score as close to 21 as possible by rolling a die as many times as you wish and adding all the numbers that appear. When a player's total exceeds 21, he is 'busted' and gets 0 points. If the player chooses to stop rolling before he exceeds 21, then he wins whatever his total is at that point. So for example, if a player rolls 5, 2, 4, and then 6, his total at that point is 17, and he has to decide whether it is worth trying again: he will be busted if he gets 5 or more (since 17+5=22), but will get a better total if he gets 4 or less.

There are many variations on this game, some involving multiple players, or a "banker" or different numbers of dice, or alcohol..... here is a short YT video explaining the basic game.

A computer can play this game with a suitable strategy. For this problem, we will consider a strategy to be simply an integer K which is the value at which you stop rolling (thinking that you are close enough to 21). The number K is fixed for the entire game. For example, if you set K = 19, then in every round, you will keep rolling if your sum to that point is less than 19; if you get a num ≥ 19 you stop. Clearly, any good strategy will be a number at least 15, since 15+6=21 and if you roll again at 15, you will never bust. But we will try all possible strategies.

QUESTION: in python

You should write a function playRound(K) which rolls a single die until you reach or exceed K or get busted, and either return your score (if you reached or exceeded K), or 0 (if you were busted). Then write a function playGame() which calls playRound(K) for N = 10,000 times for each K and returns an array of 21 numbers giving the average payoff for each K = 1, ..., 21.

Your task is to answer the following questions:

  • For each K = 1 .. 21, what is the average payoff per round for a game played with this strategy?

  • What is the best strategy for the game, meaning what value of K wins the most points on average?

Print out the values and an appropriate bar chart for the first question, and simply print out the answer to the second question using a print(...) function.

In: Computer Science

Write a C++ program to run a menu driven program with the following choices: 1) Display...

Write a C++ program to run a menu driven program with the following choices:

1) Display the grades
2) Adjust grade
3) Display Average for each student
4) Display number of student with at least a B

5) Quit

requirements:

1. Write a function called getValidGrade that allows a user to enter in an integer and loops until a valid number that is >= 0 and <= 100 is entered. It returns the valid value.

2. Write a function called getValidStudentNumber that allows a user to enter in an integer and loops until a valid number that is >= 0 and < NUM_STUDENTS is entered. It returns the valid value.

3. Write a function called getValidAssignmentNumber that allows a user to enter in an integer and loops until a valid number that is >= 0 and < NUM_GRADES is entered. It returns the valid value.

4. Write a function called displayGrades that takes the student and grade arrays as parameters and displays the grades in the format in the sample run below.

5. Write a function called displayAverageForEachStudent that takes the student and grade arrays as parameters, computes the average grade for each student, and displays the grades in the format in the sample run below.

6. Write a function called displayNumStudentsAtLeastBForSelectedAssignment that takes the student and grade arrays as parameters, allows the user to select a valid assignment and locates and displays the number of the student with at least a grade >= 80 for that assignment in the format in the sample run below.

7. Write a function called AdjustGrade that takes grade arrays as a pass by reference parameter, allows the user to select a valid student, a valid assignment, and a valid grade and changes the student assignment grade to the value entered.

8. Add comments wherever necessary.

Sample run:

Welcome to the help with the grading program!
1) Display the grades
2) Adjust grade
3) Display Average for each student
4) Display number of student with at least a B
5) Quit
Select an option (1..5)..1
Name Assign. 1 Assign. 2 Assign. 3 Assign. 4 Assign. 5
Tom 78 98 88 99 77
Jane 62 99 94 85 93
Jo 73 82 88 85 78
1) Display the grades
2) Adjust grade
3) Display Average for each student
4) Display number of student with at least a B
5) Quit
Select an option (1..5)..2
Adjust Grade
Please enter in the student number...
1
Please enter in an assignment number...
0
Please enter in the grade...
98
Grade changed
1) Display the grades
2) Adjust grade
3) Display Average for each student
4) Display number of student with at least a B
5) Quit
Select an option (1..5)..1
Name Assign. 1 Assign. 2 Assign. 3 Assign. 4 Assign. 5
Tom 78 98 88 99 77
Jane 62 99 94 85 93
Jo 98 82 88 85 78
1) Display the grades
2) Adjust grade
3) Display Average for each student
4) Display number of student with at least a B
5) Quit
Select an option (1..5)..0
Select an option (1..5)..9
Select an option (1..5)..3
Average grade for each student
Average Student 1: 88
Average Student 2: 86.6
Average Student 3: 86.2
1) Display the grades
2) Adjust grade
3) Display Average for each student
4) Display number of student with at least a B
5) Quit
Select an option (1..5)..4
Number of students with at least B
Please enter in an assignment number...
-9
Please enter in a valid assignment number...
1
Number of students with at least B on assignment 1 :1
1) Display the grades
2) Adjust grade
3) Display Average for each student
4) Display number of student with at least a B
5) Quit
Select an option (1..5)..2
Adjust Grade
Please enter in the student number...
2
Please enter in an assignment number...
1
Please enter in the grade...
-9
Please enter in a valid grade...
8888
Please enter in a valid grade...
55
Grade changed
1) Display the grades
2) Adjust grade
3) Display Average for each student
4) Display number of student with at least a B
5) Quit
Select an option (1..5)..1
Name Assign. 1 Assign. 2 Assign. 3 Assign. 4 Assign. 5
Tom 78 98 88 99 77
Jane 62 99 94 85 93
Jo 98 55 88 85 78


1) Display the grades
2) Adjust grade
3) Display Average for each student
4) Display number of student with at least a B
5) Quit
Select an option (1..5)..5

Process finished with exit code 0

In: Computer Science

What is model learning in computer science? What are its uses? what is the “Black Box”?

What is model learning in computer science?

What are its uses?

what is the “Black Box”?

In: Computer Science