Questions
a. In your own words, define the concept of "Recursion" in terms of C++ programming. b....

a. In your own words, define the concept of "Recursion" in terms of C++ programming.

b. In your own words, define the concept of "infinite recursion".

c. In your own words, define "mutual recursion" as it pertains to C++ programming.

In: Computer Science

Write a program that creates a two-dimensional array initialized with test data. Use any primitive data...

Write a program that creates a two-dimensional array initialized with test data. Use any

primitive data type that you wish. The program should have the following methods:

  • fillRandom. Accepts a reference to a two-dimensional array and fills it with random integers from 0 to 99
  • formatPrint. This method should accept a two-dimensional array and print it out row by row
  • getTotal. This method should accept a two-dimensional array as its argument and return the total of all the values in the array.
  • getAverage. This method should accept a two-dimensional array as its argument and return the average of all the values in the array. Calls getTotal and getElementCount.
  • getRowTotal. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the sub- script of a row in the array. The method should return the total of the values in the specified row.
  • getColumnTotal. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The method should return the total of the values in the specified column.
  • getHighestInRow. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The method should return the highest value in the specified row of the array.
  • getLowestInRow. This method should accept a two-dimensional array as its first argument and an integer as its second argument. The second argument should be the sub- script of a row in the array. The method should return the lowest value in the specified row of the array.
  • getElementCount. This method should accept a two-dimensional array and returns the total number of elements in the array.

Demonstrate each of the methods in this program. Each (except for getElementCount, are called from main.

The main program will request the number of rows and columns as input, creates the two-dimensional array, and first calls fillRandom. A sample output is:

Please enter the number of rows and columns in a two dimensional array: 4 5

78 65 72 30 95

60 71 88 41 73

32 74 47 70 27

59 91 80 81 87

Output:
Processing the int array.

Total : 1321

Average : 66.05

Total of row 0 : 340

Highest in row 0 : 95

Lowest in row 0 : 30

Total of row 1 : 333

Highest in row 1 : 88

Lowest in row 1 : 41

Total of row 2 : 250

Highest in row 2 : 74

Lowest in row 2 : 27

Total of row 3 : 398

Highest in row 3 : 91

Lowest in row 3 : 59

In: Computer Science

Write a java project that reads a sequence of up to 25 pairs of names and...

Write a java project that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals (sample input data is attached). Store the data in an object designed to store a first name (string), last name (string), and postal code (integer). Assume each line of input will contain two strings followed by an integer value, each separated by a tab character. Then, after the input has been read in, print the list in an appropriate format to the screen. It should also Support the storing of additional user information: street address (string), city( string), state (string), and 10-digit phone number (long integer, contains area code and does not include special characters such as '(', ')', or '-'. Need to Store the data in an ArrayList object

In: Computer Science

Write a Scheme function that takes a positive integer n and returns the list of all...

Write a Scheme function that takes a positive integer n and returns the list of all first n positive integers in decreasing order:

(decreasing-numbers 10) (10 9 8 7 6 5 4 3 2 1)

Please explain every step

In: Computer Science

1) For a given CPU, the cycle latency for a set of operations are given as...

1) For a given CPU, the cycle latency for a set of operations are given as follows: ▪ Addition:​4 ▪ Subtraction:​8 ▪ Multiplication:​64 ▪ Division:​128 If the clock of this CPU runs at 4GHz, find the following a. How many operations of each of the list above can this CPU perform in 5 minutes? b. If we have a set of operations that contains 10^9 of each operation in the list in part 1, compute the required time in seconds to execute the set. 2) Given a computer system with a hypothetical CPU of 20 lines for address bus do the following a. Compute the maximum size of RAM for this system b. If RAM is required to be 4GB, compute the minimum size of the address bus for the system.

In: Computer Science

A local T-shirt company is running a promotion as follows: For customers that buy less than...

A local T-shirt company is running a promotion as follows: For customers that buy less than 5 TShirts, there is no disconut. If a customer buys: between 6 and 10 Tshirts they get 10% discount. between 11 and 20 TShirts they get 20% discount. between 21 and 100 TShirts they get 50% discount. Write a C++ program that prompts the user for a number of TShirts. Assuming that a TShirt costs $10, calculate the appropriate discounts and display the number of TShirts bought, total amount, discount amount, and total amount due. For example, if the user bought 11 TShirts, the program should display the following: Number of TShirts bought: 11 Total amount : $ 110 Discount amount : $ 22 Total amount due : $ 88 If the user enters negative values or a 0 for number ofTshirts display an error message and ask them to run the program again.

In: Computer Science

Find the Asymptotic time complexity for each of the functions in the following: #Q2 # to...

Find the Asymptotic time complexity for each of the functions in the following:

#Q2
# to denote ayymptotic time complexity use the following notation
# O(l) O(m) O(a) O(b)
# e.g. traversing through l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] is O(l)
#1
def merge():
l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
m = [15, 16, 17, 18]
lm = []
for l_i in l:
lm.append(l_i)
for m_i in m:
lm.append(m_i)
print("lm:{}".format(lm))
#2
def merge_a_lot():
l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
m = [15, 16, 17, 18]
lm = []
for l_i in l:
lm.append(l_i)
for m_i in m:
lm.append(m_i)
print("lm:{}".format(lm))
#3
def go_through():
l = 10
lm = []
while l>0:
lm.append(l)
l=int(l/2)
print("lm:{}".format(lm))
#4
def go_through_two():
l = 10
m = 5
lm = []
while l > 0:
lm.append(l)
l = int(l/2)
m1=1
while m1*m1 <= m:
print("in")
lm.append(m1)
m1 +=1
print("lm:{}".format(lm))
#5
def go_through_cross_two():
l = 10
m = 5
lm = []
while l*l > 1:
lm.append(l)
l -= 1
m1 = 1
while m1*m1 <= m:
lm.append(m1)
m1 += 1
print("lm:{}".format(lm))
#6
def times():
a=100
b=5
sum=b
count=0
while sum<=a:
sum+=b
count+=1
print("count:{}".format(count))

In: Computer Science

Please give me an example of this java code. Vehicle - number: int - color: String...

Please give me an example of this java code.

Vehicle

- number: int

- color: String

- price: double

- horsepower: double

+ Vehicle ( )

+ Vehicle (int number)

+ Vehicle (int number, String color)

+ Vehicle (int number, String color, double price)

+ Vehicle (int number, String color, double price, double horsepower)

+getnumber( ):int

+setnumber(int number):void

+getcolor( ):String

+setcolor(String color):void

+getprice( ):double

+setprice(double price):void

+gethorsePower( ):double

+sethorsePower(double horsePower):void

toString( ):String

public String toString( )

{

return "\n\n number = " + number

+ "\n color = " + color

+ "\n price = " + price

+ "\n horsePower = " + horsePower;

public class VehicleTester

{

public static void main(String[] args)

{

Vehicle nissan1 = new Vehicle( );

nissan1.vehicleInformation( );

System.out.println(nissan1.toString( ));

}

}

In: Computer Science

Define Health informatics and its concepts?

Define Health informatics and its concepts?

In: Computer Science

Develop a Java program for the question below: A running race among animals: In a race...

Develop a Java program for the question below:

A running race among animals:

In a race among animals different types of animals are differenciated wih their running styles. In each iteration of the race, each participating animal makes a move acording to its style of running. Total length of the racecourt is NTotal (store this variable properly in the test class). Determine the winner animal and completion time of the race using polymorphism. Each of these animal classes extends from Animal class having a move method with no arguments. The current position of an animal is an integer atatring value is 0. In addition, each animal has a name attribute as well.

For generating random variables create an object from the Random class and invoke its randomize method with an integer argument (n).which returns an integer random number between 0 and (n-1).

  • Animal class: have a move method implemented differently for each animal. It also has other instance variable(s) or method(s) required by the program.
  • Rabbit class: Rabbits move as follows: with 0.4 probability a rabit sleaps makede no movment its current position in the race does not change, and with 0.6 probability make a three units move forwards. (its position increases by three units)

Note you can generate 0.4 and 0,6 proababilities with the randomize method. Invoke the method with an argument of 5 if 0 or 1 comes the rabit sleapes at this iteration, if 2,3 or 4 comes, the rabit makes a move.

  • Turtle class: turtles always moves only one unit forward. Their positions increased by one unit.
  • Test class: Create an array of animals. There can be more than one rabit or turlle in the race. At each iteration of the race (each time), all animals in the array makes a move in the order indicated by the indices in the array. Position of the animal is updated by the move method. Initially all positions are zero. At the end of each iteration or time, check whether one or more animals completed the race. The winner is the animal whose position exceeding the racecourts length, Ifd more than one animals’ position exceeds the racecscourts leength first during an iteration. This is a simple way of determining the winner, not the best way. Print the name, and score (in how many interations it completes the race) of the winner. Do not pay attension to the case of more then one winner (two ro more animals with same score exceeding the racecourt length at the same iteration)

In: Computer Science

Write a code in Python jupytoer note book: Ask the user to input a year. Check...

Write a code in Python jupytoer note book:

  1. Ask the user to input a year. Check if this is a leap year or not.

  • Ask the user to input a number. Check if this number is even or odd.

  • HbA1c of 6.5% or higher indicates diabetes. 5.7 to 6.4 indicates pre-diabetes. HbA1c less than 5.7 is considered normal. Ask the user for their HbA1c level and display if their they are in the normal range, pre-diabetic, or diabetic.

  • Ask the user to input a character and check if it is a vowel.

  • Ask the user for three numbers and find the highest of the three numbers.

  • In assignment 4.1 you completed, check if Joe made a profit or incurred a loss.

In: Computer Science

Problem1. James goes to restaurant for dinner. The items he orders are soup for $3.99, sandwich...

Problem1. James goes to restaurant for dinner. The items he orders are soup for $3.99, sandwich for $5.99 and a drink for $2.99, peach cobbler for $4.99. Calculate the subtotal, gratuity and total if the gratuity rate is 20%.

Problem2. Write a program which reads in an integer from the user and then prints out the last digit of the number that is 4 times the value which the user entered.

For example, if a user enters the number 52 , your program will compute the number 4*52=208 and print out the last digit which is 8.

Note: Use the modulo operator (%)

Problem3. Compute the volume of cylinder if the radius of the cylinder is 9 and length is 16. Assume the value of “pi” as 3.1415. Use the formula given below.

area = radius *radius*pi

volume = area *length

In: Computer Science

How are access control policies different between industries?

How are access control policies different between industries?

In: Computer Science

Why are random numbers generated with linear congruential methods not truly random? Describe the properties of...

Why are random numbers generated with linear congruential methods not truly random? Describe
the properties of the sequence of numbers these types of methods will produce.

In: Computer Science

Question 1: Defense organization of a country did a recent study, and the research recommends new...

Question 1:

Defense organization of a country did a recent study, and the research recommends new capability the country should build to keep the country protected from potential conflicts in the region. So there's a study and the solution, the system that they came up with require to be build has never been attempted, and no literature exist for such system. So it's a very fairly new area, or fairly new adventure or things that they need to create. And it's fairly big and complex system, and potentially can take decades to build. A lot of loss of time, a lot of years to build this software. And scientists have vague idea about how to go about it, but no concrete plan exists. And there'll be a lot of organization stakeholders because this of course defense organization of the country and a lot of stakeholders involved. So a lot of constraints will also be there that will impact on this initiative. So there's a lot of risk, a lot of constraints. So let's try to analyze this situation and see which model will work in this situation.

Model name :

Reason:

In: Computer Science