#Java
What is the solution? ​

#Java What Is The Solution?

Answers

Answer 1

Answer:

I have answered the first part in another question of yours, but the second part is in the provided screenshot!

Explanation:

Steps to solve this problem:

Go through all the numbers from 1 -> n1, every time you go through each of these numbers, go through all the numbers from 1 -> n2. Multiply these numbers and add them to an output string. Print each line of output.

#Java What Is The Solution?

Related Questions

C++ Project

1) Prompt the user to enter a string of their choosing (Hint: you will need to call the getline() function to read a string consisting of white spaces.) Store the text in a string. Output the string. (1 pt)

Ex:

Enter a sample text:

We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue! You entered: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue!




(2) Implement a PrintMenu() function, which has a string as a parameter, outputs a menu of user options for analyzing/editing the string, and returns the user's entered menu option. Each option is represented by a single character. If an invalid character is entered, continue to prompt for a valid choice. Hint: Implement Quit before implementing other options.

Call PrintMenu() in the main() function. Continue to call PrintMenu() until the user enters q to Quit.

More specifically, the PrintMenu() function will consist of the following steps:

-print the menu

-receive an end user's choice of action (until it's valid)

-call the corresponding function based on the above choice


Ex:

MENU

c - Number of non-whitespace characters

w - Number of words

f - Find text

r - Replace all !'s

s - Shorten spaces

q - Quit

Choose an option:




(3) Implement the GetNumOfNonWSCharacters() function. GetNumOfNonWSCharacters() has a constant string as a parameter and returns the number of characters in the string, excluding all whitespace. Call GetNumOfNonWSCharacters() in the PrintMenu() function.

Ex:

Number of non-whitespace characters: 181

(4) Implement the GetNumOfWords() function. GetNumOfWords() has a constant string as a parameter and returns the number of words in the string. Hint: Words end when a space is reached except for the last word in a sentence. Call GetNumOfWords() in the PrintMenu() function.

Ex:

Number of words:35

(5) Implement the FindText() function, which has two strings as parameters. The first parameter is the text to be found in the user provided sample text, and the second parameter is the user provided sample text. The function returns the number of instances a word or phrase is found in the string. In the PrintMenu() function, prompt the user for a word or phrase to be found and then call FindText() in the PrintMenu() function. Before the prompt, call cin.ignore() to allow the user to input a new string.

Ex:

Enter a word or phrase to be found:
more
"more" instances: 5

(6) Implement the ReplaceExclamation() function. ReplaceExclamation() has a string parameter and updates the string by replacing each '!' character in the string with a '.' character. ReplaceExclamation() DOES NOT output the string. Call ReplaceExclamation() in the PrintMenu() function, and then output the edited string.

Ex.

Edited text: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue.

(7) Implement the ShortenSpace() function. ShortenSpace() has a string parameter and updates the string by replacing all sequences of 2 or more spaces with a single space. ShortenSpace() DOES NOT output the string.

Answers

Answer:

see explaination

Explanation:

#include <iostream>

#include <string>

using namespace std;

//function declarations

char PrintMenu(string& userString);

int GetNumOfNonWSCharacters(const string userString);

int GetNumOfWords(const string userString);

int FindText(const string& userString, const string& findString);

void ReplaceExclamation(string& periodString);

void ShortenSpace(string& shortenedString);

char menuChoice;

int main()

{

string userString;

cout << "Enter a sample text: ";

getline(cin, userString);

cout << endl << endl << "You entered: " << userString << endl;

PrintMenu(userString);

while (menuChoice != 'q')

{

PrintMenu(userString);

}

// system("pause");

return 0;

}

char PrintMenu(string& userString)

{

cout << "MENU" << endl;

cout << "c - Number of non-whitespace characters" << endl;

cout << "w - Number of words" << endl;

cout << "f - Find text" << endl;

cout << "r - Replace all !'s" << endl;

cout << "s - Shorten spaces" << endl;

cout << "q - Quit" << endl << endl;

cout << "Choose an option: " << endl;

cin >> menuChoice;

while ((menuChoice != 'c') && (menuChoice != 'w') && (menuChoice != 'f') && (menuChoice != 'r') && (menuChoice != 's') && (menuChoice != 'q'))

{

cout << "MENU" << endl;

cout << "c - Number of non-whitespace characters" << endl;

cout << "w - Number of words" << endl;

cout << "f - Find text" << endl;

cout << "r - Replace all !'s" << endl;

cout << "s - Shorten spaces" << endl;

cout << "q - Quit" << endl << endl;

cout << "Choose an option: " << endl;

cin >> menuChoice;

}

if (menuChoice == 'c')

{

cout << "Number of non-whitespace characters: " << GetNumOfNonWSCharacters(userString) << endl << endl;

}

else if (menuChoice == 'w')

{

cout << "Number of words: " << GetNumOfWords(userString) << endl << endl;

}

else if (menuChoice == 'f')

{

string stringFind;

cin.clear();

cin.ignore(20, '\n');

cout << "Enter a word or phrase to be found: " << endl;

getline(cin, stringFind);

cout << "\"" << stringFind << "\"" << " instances: " << FindText(userString, stringFind) << endl;

}

else if (menuChoice == 'r')

{

cout << "Edited text: ";

ReplaceExclamation(userString);

cout << userString << endl << endl;

}

else if (menuChoice == 's')

{

ShortenSpace(userString);

cout << "Edited text: " << userString << endl;

}

return menuChoice;

}

int GetNumOfNonWSCharacters(const string userString)

{

int numCharNotWhiteSpace = 0;

for (size_t i = 0; i < userString.size(); i++)

{

if (!isspace(userString.at(i)))

{

numCharNotWhiteSpace += 1;

}

}

return numCharNotWhiteSpace;

}

int GetNumOfWords(const string userString)

{

int numWords = 1;

for (size_t i = 0; i < userString.size(); i++)

{

if (isspace(userString.at(i)) && !isspace(userString.at(i + 1)))

{

numWords += 1;

}

}

return numWords;

}

int FindText(const string& userString, const string& findString)

{

int numInstance = 0;

int indx = 0;

string editedString;

editedString = userString;

while (editedString.find(findString) != string::npos)

{

numInstance++;

indx = editedString.find(findString);

editedString = editedString.substr(indx + findString.length(), (editedString.length() - 1));

}

return numInstance;

}

void ReplaceExclamation(string& periodString)

{

for (size_t i = 0; i < periodString.size(); i++)

{

if (periodString.at(i) == '!')

{

periodString.at(i) = '.';

}

}

}

void ShortenSpace(string& shortenedString)

{

for (size_t i = 0; i < shortenedString.size(); i++)

{

if (isspace(shortenedString.at(i)) && !isalpha(shortenedString.at(i + 1)))

{

shortenedString.erase(i, 1);

}

}

}

Create an ERD based on the Crow's Foot notation using the following requirements: An INVOICE is written by a SALESREP. Each sales representative can write many invoices, but each invoice is written by a single sales representative. The INVOICE is written for a single CUSTOMER. However, each customer can have many invoices. An INVOICE can include many detail lines (LINE), each of which describes one product bought by the customer. The product information is stored in a PRODUCT entity. The product's vendor information is found in a VENDOR entity.

Answers

Answer:

Check the explanation

Explanation:

An Entity Relationship Diagram (ERD) can be described as a data structures snapshot. An Entity Relationship Diagram reveals entities (tables) in a database and the relationships among tables that are within that database. For a perfect database design it is important to have an Entity Relationship Diagram.

The below diagram is the solution to the question above.

Please refer to the MIPS solution in the question above. How many total instructions are executed during the running of this code? How many memory data references will be made during execution?

Answers

Answer:

MIPS designs are used in SGI's computer product line; in many embedded systems; on Windows CE devices; Cisco routers; and video consoles such as the Nintendo 64 or the Sony PlayStation, PlayStation 2 and PlayStation Portable. Most recently, NASA used one of them on the New Horizons probe1.

Explanation:

The earliest MIPS architectures were 32-bit fsfs (generally 32-bit wide data paths and registers), although later versions were implemented in 64-bit. There are five backward compatible revisions of the MIPS instruction set, called MIPS I, MIPS II, MIPS III, MIPS IV, and MIPS 32/64. In the last of these, MIPS 32/64 Release 2, a record control set is defined to major. Also several "extensions" are available, such as the MIPS-3D, consisting of a simple set of floating point SIMD instructions dedicated to common 3D tasks, the MDMX (MaDMaX) made up of a more extensive set of integer SIMD instructions that use 64-bit floating-point registers, MIPS16 which adds compression to the instruction flow to make programs take up less space (presumably in response to the Thumb compression technology of the ARM architecture) or the recent MIPS MT that adds multithreading functionalities similar to the HyperThreading technology of Intel Pentium 4 processors

Answer:

PLEASE SEE EXPLAINATION

Explanation:

for the code given in C Language :-

for(i=0; i<=100; i++)

{

a[i]=b[i]+C;

}

Given address of a =$a0

Gievn address of b = $a1

$t0 holds i

s0 holds constant C

Assembly Language

addi $t0, $zero, 0

loop: slti $t1, $t0, 101

beq $t1, $zero, exist

sll $t2, $t0, 2

add $t3, $t2, $a1

lw $t3, O($t3)

add $t3, $t3, $s0

add $t4, $t2, $a0

sw $t3, O($t4)

i loop

instructions of 1+101*8=809

101 itereations*2 per itereation sw)=202 data references

Write a function DrivingCost with parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type float. Ex: If the function is called with 50 20.0 3.1599, the function returns 7.89975. Define that function in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both floats). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your DrivingCost function three times. Ex: If the input is 20.0 3.1599, the output is: 1.57995 7.89975 63.198 Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a b)/3.0 is the same as a/3.0 b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. In the DrivingCost function, use the variables in the following order to calculate the cost: drivenMiles, milesPerGallon, dollarsPerGallon.

Answers

Answer:

See explaination

Explanation:

Function DrivingCost(float drivenMiles, float milesPerGallon, float dollarsPerGallon) returns float cost

float dollarsPerMile

//calculating dollars per mile

dollarsPerMile=dollarsPerGallon/milesPerGallon

//calculating cost

cost=dollarsPerMile*drivenMiles

Function Main() returns nothing

//declaring variables

float miles_per_gallon

float dollars_per_gallon

//reading input values

miles_per_gallon = Get next input

dollars_per_gallon = Get next input

//displaying cost for 10 miles

Put DrivingCost(10,miles_per_gallon,dollars_per_gallon) to output

//printing a blank space

Put " " to output

//displaying cost for 50 miles

Put DrivingCost(50,miles_per_gallon,dollars_per_gallon) to output

Put " " to output

//displaying cost for 400 miles

Put DrivingCost(400,miles_per_gallon,dollars_per_gallon) to output

1. Discuss the personal and professional implications of so much individual data being gathered, stored, and sold. Should businesses be allowed to gather as much as they want? Should individuals have more control over their data that are gathered?

Answers

Answer:

Professional implications refers  to when a number of folders in a laptop/machine goes higher,how to manage information becomes a problem, resulting into informational retrieval and storage issues.

Personal Implications refers to sharing of information on different websites, which might result in information theft or fraud once it gets into the hands of wrong people.

Business should be allowed to have access as much they want because, by having a standard procedures such as terms and conditions, this will enable them to protect their information, before allowing individuals to sign up on their sites, in terms of agreement of what the user wants to do with the contents.

Individuals should be allowed to have share more content on the internet, so that at any given time, if they can cancel the read access mode of any content they are accessing on the internet.

Explanation:

Just as the population increases, the need to store more  information by the population as goes higher.

When an any information is to be stored, it needs disk allocation or storage.  Now, we may be required to store address, Names of individuals, profile photos or phone numbers and so on. there are various path or method of achieving this.

The implications of storing this information are stated below

Professional Implications: As the number of files and folders in an office laptop/machines increases, this can lead to two vital issues which van either be information retrieval or storage issues.

Information retrieval: Putting together of  information either from knowledge of mining or data can become more tedious as the data volume is increased. This can be done by using  tools associated with knowledge mining.Storage issues: The number of disks that save data needs to be included on a regular basis for the purpose of  accommodating  the increasing customer's data.

Personal implications: This refers to sharing many personal data to different sites on the web in a way of an  electronic format this may result in  threat referred to  as'Data stealing or Theft.  

In a more understanding way, the information that is shared by us to a particular site on the web is given out to another third party website for some  benefit that are monetary.with this out information is at risk and can be used for negative purposes such as internet fraud or theft.

Business should be permitted to retrieve the data that they need unless there is standard  defined Terms and Conditions before permitting a user to have  access to their site on the web, so long as the  information they collect are used  for better and meaning purposes.

Users should be given full control to the contents that they like to share on various  website/apps. At any given time, they can cancel the read access mode from any of their contents present in internet.

Write a program in python that reads an unspecified number of integers from the user, determines how many positive and negative values have been read, computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point with 2 digits after the decimal. Here is an example of sample run: Enter an integer, the input ends if it is 0: 1 Enter an integer, the input ends if it is 0: 2 Enter an integer, the input ends if it is 0: -1 Enter an integer, the input ends if it is 0: 3 Enter an integer, the input ends if it is 0: 0 The number of positivies is 3 The number of negatives is 1 The total is 5 The average is 1.25

Answers

The program which displays the number of positive and negative values inputted. The program written in python 3 goes thus :

pos_val = 0

#initialize a variable to hold the number of positive values

neg_val = 0

#initialize a variable to hold the number of negative values

sum = 0

#initialize a variable to hold the sum of all values

while True :

#A while loop is initiated

val = int(input("Enter integer values except 0 : "))

#prompts user for inputs

if val == 0 :

#checks if inputted value is 0

 break

#if True end the program

else :

#otherwise

 sum +=val

#add the value to the sum variable

 

 if val > 0 :

#checks if value is greater than 0

  pos_val += 1

#if true increase positive value counts by 1

 else :

  neg_val += 1

#if otherwise, increase negative value counts by 1

freq = float(pos_val + neg_val )

#calculates total number of values

print('The number of positive values is = ', pos_val)

#display number of positive values

print('The number of negative values is = ', neg_val)

#display number of negative values

print('The total sum of values is = ', sum)#display the total sum

print('The average is {:.2f}' .format((sum))

#display the average of the inputs

Learn more : https://brainly.com/question/19323897

The program reads integers from the user until 0 is entered, counts positive and negative values, calculates total and average (excluding zeros), and outputs the results.

Here's the Python program that meets the requirements:

positives = 0

negatives = 0

total = 0

count = 0

# Loop to read integers from user

while True:

   num = int(input("Enter an integer, the input ends if it is 0: "))    

   # Check if the input is 0 to end the loop

   if num == 0:

       break    

   # Increment counters based on positive/negative values

   if num > 0:

       positives += 1

   elif num < 0:

       negatives += 1    

   # Add non-zero input to total and increment count

   if num != 0:

       total += num

       count += 1

# Calculate average (excluding zeros)

if count != 0:

   average = total / count

else:

   average = 0

# Output results

print("The number of positives is", positives)

print("The number of negatives is", negatives)

print("The total is", total)

print("The average is {:.2f}".format(average))

The program initializes variables to count positive and negative integers, keep track of the total, and count the number of inputs.It uses a `while` loop to continuously read integers from the user until 0 is entered.Inside the loop, it updates the counters for positive and negative integers, adds non-zero integers to the total, and increments the count.After the loop, it calculates the average (excluding zeros) and outputs the results using formatted strings.

This program meets the requirements specified in the prompt and terminates when the user enters 0.

How do i enter this as a formula into excel IF function?




In cell C15, enter a formula using an IF function to determine if you need a loan. Your available cash is located on the Data sheet in cell A3 ($9000). If the price of the car is less than or equal to your available cash, display "no". If the price of the car is more than your available, cash, display "yes". Use absolute references where appropriate—you will be copying this formula across the row. The available cash is 9000




What would I enter into the Logical_test section?

Answers

Answer:

Call microsoft

Explanation:

Exel Is My Worst Nightmare Just Call Microsoft "I'd Hope They'd Have A Answer For That"

The IF function allows the user to make logical comparison among values.

The formula to enter in cell 15 is: [tex]\mathbf{=IF(\$A\$4 > \$A\$3, "yes", "no")}[/tex]

The syntax of an Excel IF function is:

[tex]\mathbf{=IF (logical\_test, [value\_if\_true], [value\_if\_false])}[/tex]

Where:

IF [tex]\to[/tex] represents the IF function itselflogical_test [tex]\to[/tex] represents values to be compared[value_if_true] [tex]\to[/tex] represents the return value if the condition is true [value_if_false] [tex]\to[/tex] represents the return value if the condition is false

From the question, the cells to compare are:

Cell A3The cell that contains the car price (assume the cell is A4)

So, the IF function that compares both cells is:

[tex]\mathbf{=IF(A4 > A3, "yes", "no")}[/tex]

The above formula checks if A4 is greater than A3.

If the condition is true, the result is "yes"Otherwise, it is "no"

The question requires that the cells are referenced using absolute cell referencing.

This means that, we make use of the dollar sign ($), when writing the cells.

So, the correct formula is:

[tex]\mathbf{=IF(\$A\$4 > \$A\$3, "yes", "no")}[/tex]

Read more about Excel formulas at:

https://brainly.com/question/1285762

List the physical storage media available on the computers you use routinely. Give the speed with which data can be accessed on each medium. (Your answer will be based on the computers and storage media that you use)

Answers

Answer:

In daily routine I use different physical storage media such as Hard disk drive, USB (Flash Memory). Data can be accesses through these devices at the speed of up to 100 Mbps and 1 Mbps respectively.

Explanation:

There are different storage media that we can use to transfer data between different computer devices or store data permanently such as hard disk drive, floppy disk, optical storage devices (CD and DVD), USB (Flash Memory) and SD Cards. These storage medias have different purpose and different applications of use. All these devices works on different accessing speed of data.

In my daily routine, I usually use Hard disk drive for permanent storage of my important data and USB device for transferring data between different device or to keep data temporarily. Hard disk drives are available in terabyte size now a days while USB drives are available in the range 32 to 64 GB. Hard disk drive has data accessing speed of up to 100 Mbps and USB drive has almost speed of up to 1 Mbps to access data.

Answer the following questions based on your readings from Module 1. Describe a time when you or someone you observed showed a poor work ethic. Discuss how their work ethic can be improved. Apart from good work ethic and communication skills, what are two more skills that are good for IT professionals? Your answer should be between 150 to 200 words. (10 points)

Answers

Answer:

An example  of poor work ethic which I encountered recently was the observation of poor hygiene by an employee of a fast-food outlet of a renowned company.

Explanation:

Some patties suddenly slipped out of his hands and fell on the ground. He did not discard them and simply put them into burg adversely. ers. The fall must have soiled and contaminated them, which would affect the health of consumers. Such incidents can be avoided by the company by training the staff in such possibilities and suggesting corrective actions. Monitoring and taking action against offenders will also help. IT professionals should have good analytical and interpersonal skills besides cross-cultural sensitivity to do good in their roles.

You should apologize for his mistake for reaching the wrong place. The message should be through an electronic message ( sms ) or another instant messaging service, followed by a telephone call. The content of the message should comprise of an apology for not being able to reach in time, the reason for the misunderstanding, your current location and the approximate time it will take to reach the venue. It will be better if you share your location with the client through a GPS enabled application, so that it will be convenient to coordinate.

The tow more skills that are good for IT professionals the the skill off After sale services, and to establish a good relationship with clients.

Answer the following Python Interview questions • How is Python an interpreted language? • What is the difference between Python Arrays, lists, tuples, and records? Explain it with examples • What does [::-1] do? Explain it with an example • How can you randomize the items of a list in place in Python? • What is the difference between range & xrange?Explain it with an example • What advantages do NumPy arrays offer over (nested) Python lists? • How to add values to a python array? Explain it with an example • What is split used for? Explain it with an example

Answers

Answer:

1. Python is called as interpreted language. However as a programming language it is not fully compiled nor interpreted language. Python program runs from direct source code which makes it byte code interpreted.

An Interpreter is the one which takes the code and performs the actions specified in the code. It turns the code into intermediate language which is again translated to machine language understood by the processor. Interpreted or compiled are the property of the implementation and not of the language.

2. Array : It is a collection of same data type elements stored at contagious memory location. It is handled in python with module array. All the elements of array must be of same data type. In order to manipulate same data types arrays are used.

Ex: array1 = a.array ('i', [10, 20, 30]) this is a array of integer type.

Lists : Python lists are ordered data structure and are like non homogeneous dynamic sized arrays. It may contain integers, strings, boolean, or objects.

Ex: List1 = [70, 89, 98] , List2 = ["Rose", "Lilly", "Jasmine"]

List3 = [1, 10, 100, 'Test', 'Test1']

Tuple : It is a collection of objects separated by commas and they are immutable. It is static which makes them faster.

Ex: tupule1 = ('element1', 'element2')

List and Tuple in Python are the class of data structure. The list is dynamic, whereas tuple has static characteristics.

Lists are mutable but tuples are not.

tuples are mainly used to access the elements where as lists are used in operations like insertion and deletion.

Iterations are time consuming in list where as it is faster in tuples.

tuples don't have inbuilt methods but list has many builtin methods.

tuples takes slightly less memory that lists in Python

Records: Records data structure will have fixed number of fields and each field may have a name and different type. Immutable records are implemented using named tuple.

3. Syntax of slice in python is list[<start>:<stop>:<step>] and it can be used on tuples and lists.

so X [::-1] means that it will start from the end towards the first element by taking each of the elements.

for ex: X = '9876'

X [::-1] will result in '6789'.

Means it will reverse all the elements in the array.

4. Items of list can be shuffled with the random.shuffle() function of a random module.

Syntax is : random.shuffle(x, random)

x- It is a sequence to shuffle and can be list or tuple.

random- it is a optional argument which returns random float number between 0.1 to 1.0.

5. range() – Range function returns a range object which is a type of iterable object.

xrange() – xrange function returns the generator object that can be used to display numbers only by looping. Only particular range is displayed on demand and hence called “lazy evaluation“.

• Return type of range () is range object whereas that of xrange() is xrange object.

• Variable to store the range using range () takes more memory but xrange takes comparative less memory.

• Range returns the list but xrange returns the xrange object. Hence operations on list can be applied for range but not on xrange.

• Xrange is faster to implement than range as xrange evaluates only generator objects.

• Xrange is depreciated in Python 3 and above.

For ex :

x = range (10, 100)

y= xrange (10, 100)

#To know the return type we can print it

print ( return type of range () is : “)

print (type (x))

print ( return type of xrange () is : “)

print (type (y))

Output will be list and xrange respectively.

6. NumPy's arrays are more compact than Python lists

reading and writing items is also faster with NumPy.

Memory taken by python lists are way higher than NumPy arrays.

Python lists don’t support vectorized operation.

Since lists can contain objects of different types its type information must be stored and executed every time operation is performed on it.

Memory taken by python lists are a lot higher than that of NumPy Arrays.

Reading and writing of elements in NumPy arrays are faster than lists.

NumPy arrays are compact and accumulate lesser storage.

Numpy is convenient and efficient.

For ex :

Metrics operations are easy in NumPy.

Checkerboard pattern can be done using NumPy.

7. Attached as Image

8. split() method returns a list of strings after breaking the given string by the specified separator. It is splitting of string into list with each word is a list item.

Syntax : str.split ( separator, maxsplit)

Separator : its is delimiter used and by default whitespace is used as separator.

Maxsplit : Maximum number of times to split the string. By default it has no limit.

For ex:

text = 'apples and oranges are different '

print(text.split())

output will be : ['apples', 'and', 'oranges', 'are', 'different' ]

Explanation:

Answer:

It Is C to shorten it The answer is C

Explanation:

A digital pen is an example of this type of device used in the information processing cycle.

Answers

Answer:

 input device, data capture device

Explanation:

A digital pen is an input device that can be used for data capture.

• Reads an integer n (you can assume n won’t be negative and don’t worry about exception handling) • Using a recursive method, compute and write to the screen all integers with n digits in which the digit values are strictly increasing. For example, if n =3, the result is 012 013 014 015 016 017 018 019 023 024 025 026 027 028 029 034 035 036 037 038 039 045 046 047 048 049 056 057 058 059 067 068 069 078 079 089 123 124 125 126 127 128 129 134 135 136 137 138 139 145 146 147 148 149 156 157 158 159 167 168 169 178 179 189 234 235 236 237 238 239 245 246 247 248 249 256 257 258 259 267 268 269 278 279 289 345 346 347 348 349 356 357 358 359 367 368 369 378 379 389 456 457 458 459 467 468 469 478 479 489 567 568 569 578 579 589 678 679 689 789

Answers

Answer:

The Codes and Screenshot to answer the question above are both given below:(the Screenshot is attached to offer you an additional readability of code)

note: File Name must be the same as our class name ( which is Increasing.java in our case.)

Explanation:

Code is given below:

/* File Name Should be Increasing.java

* Java program to print all n-digit numbers whose digits

* are strictly increasing from left to right

*/

import java.util.Scanner;

class Increasing

{

   // Function to print all n-digit numbers whose digits

   // are strictly increasing from left to right.

   // out --> Stores current output number as string

   // start --> Current starting digit to be considered

   public static void findStrictlyIncreasingNum(int start, String out, int n)

   {

       // If number becomes N-digit, print it

       if (n == 0)

       {

           System.out.print(out + " ");

           return;

       }

       // Recall function 9 time with (n-1) digits

       for (int i = start; i <= 9; i++)

       {

           // append current digit to number

           String str = out + Integer.toString(i);

           // recurse for next digit

           findStrictlyIncreasingNum(i + 1, str, n - 1);

       }

   }

   // Driver code for above function

   public static void main(String args[])

   {   //User Input

       Scanner sc = new Scanner( System.in);

       System.out.println("Enter a number:");

       int n = sc.nextInt();

       //Function to calcuclate and print strictly Increasing series

       findStrictlyIncreasingNum(0, " ", n);

   }

}

//End of Code

12. In cell I9, create a formula without using a function that first adds the selected boxed set’s net weight (cell I8) to the packing weight (cell F5), and then divides the value by 16 to show the shipping weight in pounds.

Answers

Answer:

=(I8+F5)/16

Explanation:

In cell I9, we type the following

=(I8+F5)/16

I8 is the boxed set net weight

F5 is the packing weight

The question asked us to add and divide by 16

We use the addition operator '+' instead of built-in "SUM" function as required by the question.

So, we add I8 and F5 and then divide by 16 in cell I9.

Suppose you are an art thief (not a good start) who has broken into an art gallery. All you have to haul out your stolen art is your briefcase which holds only W pounds of art and for every piece of art, you know its weight. Write a program that contains a dynamic programming function to determine your maximum profit. Include a main program that tests your function against each of the following two data sets (each happens to have n=5 items; but your function should work for other values of n as well; we are likely to test your code against another random dataset with an unknown number of items):

Data set 1:

Items 1, 2, 3, 4, and 5 have weights 2, 3, 4, 5 , 9 and value 3, 4, 8, 8, and 10, respectively. Let W = 20.

Data set 2:

Items 1, 2, 3, 4, and 5 have weights 1, 2, 5, 6, 7 and value 1, 6, 18, 22, and 28, respectively. Let W = 11.

Answers

Answer:

Check the explanation

Explanation:

weights = [2,3,4,5,9] #assign the weights here

value = [3,4,8,8,10] #assign the values here

#recursive function to get the maximum weight for a given knapsack

def getMaxWeight(weights,value,W,n):

#check if any elements are there or check if the knapsack can hold any more weights

if(n==0 or W==0):

return 0

elif(weights[n]>W):

#if the current value of the weight is greater than what a knapsack can hold then discard that

return getMaxWeight(weights,value,W,n-1)

else:

#either choose the current weight or do not choose based on the maximum values

return max(value[n]+getMaxWeight(weights,value,W-weights[n],n-1),getMaxWeight(weights,value,W,n-1))

if __name__ == '__main__':

W=20

n=len(weights)-1

print("Weights are:",weights)

print("Values are:",value)

print("Maximum value for given knapsack is:",getMaxWeight(weights,value,W,n))

Kindly check the attached output images below.

(a) Implement (in Java) the RadixSort algorithm to sort in increasing order an array of integer keys.

public void radixSort(int arr[])

In your implementation you must consider that each key contains only even digits (0, 2, 4, 6, and 8). Your program must detect the case of odd digits in the keys, and, in this case, abort.

Note: To storage and process the bucket lists, use an ArrayList structure.

(b) What is the running time complexity of your radixSort method? Justify.

Answers

‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎   ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎ .‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎  ‏‏‎

Final answer:

The provided response includes a Java implementation of the radixSort algorithm that sorts an array of integers with only even digits and aborts if odd digits are found. The running time complexity is O(nk) but is effectively O(n) due to the fixed set of digits.

Explanation:

The student has asked to implement the radixSort algorithm in Java, which sorts an array of integers containing only even digits (0, 2, 4, 6, and 8). Moreover, the program should abort if odd digits are present in the keys. Here's an example implementation:

import java.util.ArrayList;

class RadixSortExample {
   public void radixSort(int[] arr) {
       final int RADIX = 10;

       // Find the maximum number to know the number of digits
       int max = arr[0];
       for (int i = 1; i < arr.length; i++) {
           if (arr[i] > max) max = arr[i];
       }

       // Abort if odd digits found
       for (int num : arr) {
           if (containsOddDigit(num)) {
               throw new IllegalArgumentException("Array contains odd digits, which is not allowed.");
           }
       }

       // Perform sorting
       for (int exp = 1; max / exp > 0; exp *= RADIX) {
           countSort(arr, exp);
       }
   }

   private void countSort(int[] arr, int exp) {
       ArrayList<ArrayList<Integer>> bucketList = new ArrayList<>(10);
       for (int i = 0; i < 10; i++) {
           bucketList.add(new ArrayList<>());
       }

       // Distribute the numbers based on the digit at the given exponent
       for (int num : arr) {
           int bucketIndex = (num / exp) % 10;
           bucketList.get(bucketIndex).add(num);
       }

       // Merge the buckets
       int index = 0;
       for (int i = 0; i < 10; i++) {
           for (int num : bucketList.get(i)) {
               arr[index++] = num;
           }
       }
   }

   private boolean containsOddDigit(int num) {
       while (num > 0) {
           if ((num % 10) % 2 != 0) return true;
           num /= 10;
       }
       return false;
   }
}

As for the running time complexity of the radixSort method, it is O(nk), where n is the number of keys and k is the number of digits in the maximum key. The algorithm runs digit by digit, but since we're dealing with a fixed set of digits (even digits only), the k value is bounded and the complexity can also be seen as O(n) for practical considerations, especially when the range of the input is restricted.

6.4 Predicting Prices of Used Cars. The file ToyotaCorolla.csv contains data on used cars (Toyota Corolla) on sale during late summer of 2004 in the Netherlands. It has 1436 records containing details on 38 attributes, including Price, Age, Kilometers, HP, and other specifications. The goal is to predict the price of a used Toyota Corolla based on its specifications. (The example in Section 6.3 is a subset of this dataset.) Split the data into training (50%), validation (30%), and test (20%) datasets. Run a multiple linear regression with the outcome variable Price and predictor variables Age_08_04, KM, Fuel_Type, HP, Automatic, Doors, Quarterly_ Tax, Mfr_Guarantee, Guarantee_Period, Airco, Automatic_airco, CD_Player, Powered_Windows, Sport_Model, and Tow_Bar. a. What appear to be the three or four most important car specifications for predicting the car’s price?

Answers

Answer:

Compare the predictions in terms of the predictors that were used, the magnitude of the difference between the two predictions, and the advantages and disadvantages of the two methods.

Our predictions for the two models were very simmilar. A difference of $32.78 (less than 1% of the total price of the car) is statistically insignificant in this case. Our binned model returned a whole number while the full model returned a more “accurate” price, but ultimately it is a wash. Both models had comparable accuracy, but the full regression seemed to be better trained. If we wanted to use the binned model I would suggest creating smaller bin ranges to prevent underfitting the model. However, when considering the the overall accuracy range and the car sale market both models would be

Explanation:

Checkpoint 7.61 Write the prototype for a function named showSeatingChart that will accept the following two-dimensional array as an argument. const int ROWS = 20; const int COLS = 40; string seatingChart[ROWS][COLS]; Note: The two-dimensional array argument must be a const string array. You must include a second integer argument (scalar, not an array).

Answers

Answer:

void showSeatingChart(const string [][COLS], int);

Explanation:

void showSeatingChart(const string [][COLS], int);

The above function showSeatingChart() will display the 2D array of seating chart.

The return type of this function is void because it does not need to retun anything.

The parameter of the function is a 2D array which is seatingChart[ROWS][COLS].

The type of this 2D array is string that means it is a 2D array of string. It will contain string elements.

To declare a prototype of a function, there should be a semi-colon (;) at the end of declaration.

The definition of the function should be given outside main() function and declaration of the function should be above the main() function or at the beginning of the program with declaration of constant variables.

Write a method manyStrings that takes an ArrayList of Strings and an integer n as parameters and that replaces every String in the original list with n of that String. For example, suppose that an ArrayList called "list" contains the following values:("squid", "octopus")And you make the following call:manyStrings(list, 2);Then list should store the following values after the call:("squid", "squid", "octopus", "octopus")As another example, suppose that list contains the following:("a", "a", "b", "c")and you make the following call:manyStrings(list, 3);Then list should store the following values after the call:("a", "a", "a", "a", "a", "a", "b", "b", "b", "c", "c", "c")You may assume that the ArrayList you are passed contains only Strings and that the integer n is greater than 0.

Answers

Answer:

public static ArrayList manyStrings(ArrayList<String> list, int n){

    ArrayList<String> newList = new ArrayList<String>();

    for (int i=0; i<list.size(); i++) {

        for (int j=0; j<n; j++) {

            newList.add(list.get(i));

        }

    }

    return newList;

}

Explanation:

Create a method called manyStrings that takes two parameters, list and n

Create a new ArrayList that will hold new values

Create a nested for loop. The outer loop iterates through the list. The inner loop adds the elements, n of this element, to the newList.

When the loops are done, return the newList

In this assignment you will write a function that will calculate parallel resistance for up to 10 parallel resistors. Call the function by ParallelR(Number), where Number is an integer between 1 and 10 which will be input from a command window prompt. Use a for loop Number times to find the Numerator and Denominator for parallel resistance. After the for loop you should find Solution as Num/Den. the number Solution will be returned by the function.

Answers

Answer:

See explaination

Explanation:

format RAT

Number=input('Enter the no. of resistors:');

R=ParallelR(Number)

function Req=ParallelR(N)

R=0;

for i=1:N

r=input('Enter Resistor Value:');

R=R+1/r;

end

Req=(1/R);

end

Using the C language, write a function that accepts two parameters: a string of characters and a single character. The function shall return a new string where the instances of that character receive their inverse capitalization. Thus, when provided with the character ’e’ and the string "Eevee", the function shall return a new string "EEvEE". Using the function with the string "Eevee" and the character ’E’ shall produce "eevee".

Answers

Answer:

#include <stdio.h>

void interchangeCase(char phrase[],char c){

  for(int i=0;phrase[i]!='\0';i++){

      if(phrase[i]==c){

          if(phrase[i]>='A' && phrase[i]<='Z')

              phrase[i]+=32;

          else

              phrase[i]-=32;      

      }

  }

}

int main(){

  char c1[]="Eevee";

  interchangeCase(c1,'e');

  printf("%s\n",c1);

  char c2[]="Eevee";

  interchangeCase(c2,'E');

  printf("%s\n",c2);    

}

Explanation:

Create a function called interchangeCase that takes the phrase and c as parameters.Run a for loop that runs until the end of phrase and check whether the selected character is found or not using an if statement.If the character is upper-case alphabet, change it to lower-case alphabet and otherwise do the vice versa.Inside the main function, test the program and display the results.

Write the constructor for the Theater class. The constructor takes three int parameters, representing the number of seats per row, the number of tier 1 rows, and the number of tier 2 rows, respectively. The constructor initializes the theaterSeats instance variable so that it has the given number of seats per row and the given number of tier 1 and tier 2 rows and all seats are available and have the appropriate tier designation. Row 0 of the theaterSeats array represents the row closest to the stage. All tier 1 seats are closer to the stage than tier 2 seats. Complete the Theater constructor. /** Constructs a Theater object, as described in part (a). * Precondition: seatsPerRow > 0; tier1Rows > 0; tier 2 Rows >= 0 */ public Theater(int seatsPerRow, int tier1Rows, int tier 2 Rows)

Answers

Answer:

See explaination

Explanation:

class Seat {

private boolean available;

private int tier;

public Seat(boolean isAvail, int tierNum)

{ available = isAvail;

tier = tierNum; }

public boolean isAvailable() { return available; }

public int getTier() { return tier; }

public void setAvailability(boolean isAvail) { available = isAvail; } }

//The Theater class represents a theater of seats. The number of seats per row and the number of tier 1 and tier 2 rows are

//determined by the parameters of the Theater constructor.

//Row 0 of the theaterSeats array represents the row closest to the stage.

public class Theater {

private Seat[][] theaterSeats; /** Constructs a Theater object, as described in part (a). * Precondition: seatsPerRow > 0; tier1Rows > 0; tier2Rows >= 0 */

public Theater(int seatsPerRow, int tier1Rows, int tier2Rows) {

theaterSeats= new Seat[tier1Rows+tier2Rows][seatsPerRow];

}

public boolean reassignSeat(int fromRow, int fromCol, int toRow, int toCol) {

if(theaterSeats[toRow][toCol].isAvailable()) {

int tierDestination =theaterSeats[toRow][toCol].getTier();

int tierSource =theaterSeats[fromRow][fromCol].getTier();

if(tierDestination<=tierSource) {

if(tierDestination==tierSource) {

if(fromRow<toRow) {

return false;

}else {

theaterSeats[toRow][toCol].setAvailability(false);

theaterSeats[fromRow][fromCol].setAvailability(true);

return true;

}

}

theaterSeats[toRow][toCol].setAvailability(false);

theaterSeats[fromRow][fromCol].setAvailability(true);

return true;

}else {

return false;

}

}else {

return false;

}

}

public static void main(String[] args) {

//Lets understand it with simple example

Theater t1 = new Theater(3,1,2);

//Our threater has 3 seat in each row and we have one tier 1 row and 1 tier 2 row

//total no of seat will be 9.

//Lets create our seat

t1.theaterSeats[0][0] = new Seat(true,1);

t1.theaterSeats[0][1] = new Seat(false,1);

t1.theaterSeats[0][2] = new Seat(true,1);

t1.theaterSeats[1][0] = new Seat(true,2);

t1.theaterSeats[1][1] = new Seat(true,2);

t1.theaterSeats[1][2] = new Seat(true,2);

t1.theaterSeats[2][0] = new Seat(false,2);

t1.theaterSeats[2][1] = new Seat(false,2);

t1.theaterSeats[2][2] = new Seat(true,2);

//Lets print out theater and see which seat is available or which is not

System.out.println("Theater===>");

for(int i=0;i<3;i++) {

for(int j=0;j<3;j++) {

System.out.print("["+i+"]"+"["+j+"] : "+t1.theaterSeats[i][j].isAvailable()+" ");

}

System.out.println();

}

System.out.println("(2,1) want to change seat to (0,0)");

System.out.println("["+2+"]"+"["+1+"]"+"===>"+"["+0+"]"+"["+0+"]");

t1.reassignSeat(2, 1, 0, 0);

for(int i=0;i<3;i++) {

for(int j=0;j<3;j++) {

System.out.print("["+i+"]"+"["+j+"] : "+t1.theaterSeats[i][j].isAvailable()+" ");

}

System.out.println();

}

}

}

a.Create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. Create a separate method to do the calculation and return the result to be displayed.

b. Modify the program in Excercise 3a so that the main program prompts the user for the amount of money and passes it to the interest calculating method.

c. Modify the program in Excercise 3b so that the main program also prompts the user for the interest rate and passses both the amount of money and the interest rate to the interest calculating method.

// Pseudocode PLD Chapter 9 #3 pg. 421

// Start

// Declarations

// num amount

// num newAmount

// num interestRate

// output "Please enter the dollar amount. "

// input amount

// output "Please enter the interest rate(e.g., nine percet should be entered as 9.0). "

// input interestRate

// newAmount = FutureValue(amount,interestRate)

// output "The new dollar amount is ", newAmount

// Stop

//

//

//

// num FutureValue(num initialAmount, num interestRate)

// Declarations

// num finalAmount

// finalAmount = (1 + interestRate/100) * initialAmount

// return finalAmount

Answers

Answer:

see explaination

Explanation:

a)

amount = 5000

rate = 2

year = 1

interest = calculateInterest(amount, rate, year);

finalAmount = amount + interest

###### function ######

calculateInterest(amount, rate, year):

interest = (amount*rate*year)/100;

return interest

b)

amount <- enter amount

rate = 2

year = 1

interest = calculateInterest(amount, rate, year);

finalAmount = amount + interest

###### function ######

calculateInterest(amount, rate, year):

interest = (amount*rate*year)/100;

return interest

c)

#include <iostream>

using namespace std;

// function defination

double calculateInterest(double amount, double rate, int year);

int main(){

double amount, rate;

int year = 1;

cout<<"Enter amount: ";

cin>>amount;

cout<<"Enter rate: ";

cin>>rate;

// calling method

double interest = calculateInterest(amount, rate, year);

cout<<"Amount after 1 year: "<<(amount+interest)<<endl;

return 0;

}

// function calculation

double calculateInterest(double amount, double rate, int year){

return (amount*rate*year)/100.0;

}

In this exercise we have to use the knowledge in computational language in python to write the following code:

We have the code can be found in the attached image.

So in an easier way we have that the code is

a)amount = 5000

rate = 2

year = 1

interest = calculateInterest(amount, rate, year);

finalAmount = amount + interest

calculateInterest(amount, rate, year):

interest = (amount*rate*year)/100;

return interest

b)amount <- enter amount

rate = 2

year = 1

interest = calculateInterest(amount, rate, year);

finalAmount = amount + interest

calculateInterest(amount, rate, year):

interest = (amount*rate*year)/100;

return interest

c)#include <iostream>

using namespace std;

double calculateInterest(double amount, double rate, int year);

int main(){

double amount, rate;

int year = 1;

cout<<"Enter amount: ";

cin>>amount;

cout<<"Enter rate: ";

cin>>rate;

double interest = calculateInterest(amount, rate, year);

cout<<"Amount after 1 year: "<<(amount+interest)<<endl;

return 0;

}

double calculateInterest(double amount, double rate, int year){

return (amount*rate*year)/100.0;

}

See more about python at brainly.com/question/18502436

What are the final TTL and the destination IP enclosed in the set of IP datagrams when they arrive at the webserver www.? Does this webserver send a UDP segment or an ICMP message back to the host? What are the type and code enclosed in such UDP segment or ICMP message? What’s the source IP in the IP datagram carrying this UDP/ICMP packet? Whose IP is used as the destination IP for this UDP/ICMP packet? (hint: websever’s, my computer’s, router 147.153.69.30’s, or …?)

Answers

Answer:particular layer N, a PDU is a complete message that implements the protocol at that layer. However, when this “layer N PDU” is passed down to layer N-1, it becomes the data that the layer N-1 protocol is supposed to service. Thus, the layer N protocol data unit (PDU) is called the layer N-1 service data unit (SDU). The job of layer N-1 is to transport this SDU, which it does in turn by placing the layer N SDU into its own PDU format, preceding the SDU with its own headers and appending footers as necessary. This process is called data encapsulation, because the entire contents of the higher-layer message are encapsulated as the data payload of the message at the lower layer.

What does layer N-1 do with its PDU? It of course passes it down to the next lower layer, where it is treated as a layer N-2 SDU. Layer N-2 creates a layer N-2 PDU containing the layer N-1 SDU and layer N-2’s headers and footers. And the so the process continues, all the way down to the physical layer. In the theoretical model, what you end up with is a message at layer 1 that consists of application-layer data that is encapsulated with headers and/or footers from each of layers 7 through

Explanation:

python Write a class named Taxicab that has three **private** data members: one that holds the current x-coordinate, one that holds the current y-coordinate, and one that holds the odometer reading (the actual odometer distance driven by the Taxicab, not the Euclidean distance from its starting point). The class should have an init method that takes two parameters and uses them to initialize the coordinates, and also initializes the odometer to zero. The class should have get methods for each data member: get_x_coord, get_y_coord, and get_odometer. The class does not need any set methods. It should have a method called move_x that takes a parameter that tells how far the Taxicab should shift left or right. It should have a method called move_y that takes a parameter that tells how far the Taxicab should shift up or down. For example, the Taxicab class might be used as follows:

Answers

Answer:

see explaination

Explanation:

class Taxicab():

def __init__(self, x, y):

self.x_coordinate = x

self.y_coordinate = y

self.odometer = 0

def get_x_coord(self):

return self.x_coordinate

def get_y_coord(self):

return self.y_coordinate

def get_odometer(self):

return self.odometer

def move_x(self, distance):

self.x_coordinate += distance

# add the absolute distance to odometer

self.odometer += abs(distance)

def move_y(self, distance):

self.y_coordinate += distance

# add the absolute distance to odometer

self.odometer += abs(distance)

cab = Taxicab(5,-8)

cab.move_x(3)

cab.move_y(-4)

cab.move_x(-1)

print(cab.odometer) # will print 8 3+4+1 = 8

Final answer:

The Taxicab class in Python should have private data members for x-coordinate, y-coordinate, and the odometer. It includes an initializer, get methods for each data member, and methods to move the taxicab horizontally and vertically, updating the odometer with each movement.

Explanation:

The student's question pertains to writing a Python class named Taxicab which models a taxicab's movements and odometer readings. To implement this, you would define the class with private data members for the x-coordinate, y-coordinate, and odometer reading. The odometer should track the total distance driven rather than the Euclidean distance from the start point. The class should have an init method to initialize these values, where the x and y coordinates are set by provided parameters and the odometer starts at zero. Additionally, there should be get methods for each of these private data members to allow access to their values. Movement methods move_x and move_y should be implemented to handle horizontal and vertical movements, respectively, and the odometer should be updated accordingly based on the magnitude of the movement.

In the sport of diving, seven judges award a score between 0 and 10, where each score may be a floating-point value. The highest and lowest scores are thrown out and the remaining scores are added together. The sum is then multiplied by the degree of difficulty for that dive. The degree of difficulty ranges from 1.2 to 3.8 points. The total is then multiplied by 0.6 to determine the diver’s score. Write a computer program that will ultimately determine the diver’s score. This program must include the following methods:

Answers

A diver's score in diving is calculated by taking the middle five scores from judges, summing them up, multiplying by the dive's degree of difficulty, and then multiplying by 0.6. A computer program designed to calculate these scores would need to incorporate methods for each step of this process.

The sport of diving involves judges awarding scores to divers based on their performance. To calculate a diver's score, a computer program must follow these steps:

Receive a score between 0 and 10 from each of the seven judges.Discard the highest and lowest scores.Add the remaining five scores together.Multiply this sum by the degree of difficulty for the dive, which ranges from 1.2 to 3.8.Finally, multiply by 0.6 to determine the diver's final score.

This scoring system ensures that outliers do not disproportionately affect the diver's score and that the degree of difficulty is appropriately factored into the final score, producing a fair assessment of the performance. The computer program must include methods to perform each of these tasks, ensuring accurate point tallies and final calculations for each dive.

Objective:This assignment is designed to give you experience with thinking about algorithm analysis and performanceevaluation.Project DescriptionYou will analyze three algorithms to solve the maximum contiguous subsequence sum problem, and then evaluate the performance of instructor-supplied implementations of those three algorithms. You will compare your theoretical results to your actual results in a written report.What is the maximum contiguous subsequence sum problem?Given a sequence of integers A1, A2 ... An (where the integers may be positive or negative), find a subsequence Aj, ..., Ak that has the maximum value of all possible subsequences.The maximum contiguous subsequence sum is defined to be zero if all of the integers in the sequence are negative.

Answers

Answer:

Check the explanation

Explanation:

#include<stdio.h>

/*Function to return max sum such that no two elements

are adjacent */

int FindMaxSum(int arr[], int n)

{

 int incl = arr[0];

 int excl = 0;

 int excl_new;

 int i;

 for (i = 1; i < n; i++)

 {

    /* current max excluding i */

    excl_new = (incl > excl)? incl: excl;

    /* current max including i */

    incl = excl + arr[i];

    excl = excl_new;

 }

  /* return max of incl and excl */

  return ((incl > excl)? incl : excl);

}

/* Driver program to test above function */

int main()

{

 int arr[] = {5, 5, 10, 100, 10, 5};

 printf("%d \n", FindMaxSum(arr, 6));

 getchar();

 return 0;

}

The programming projects of Chapter 4 discussed a Card class that represents a standard playing card. Create a class called DeckOfCards that stores 52 objects of the Card class. Include methods to shuffle the deck, deal a card, and report the number of cards left in the deck. The shuffle method should assume a full deck. Create a driver class with a main method that deals each card from a shuffled deck, printing each card as it is dealt.

Answers

The DeckOfCards class manages a deck of 52 Card objects. It provides methods to shuffle, deal a card, report the number of cards left, and display the deck.

To implement the DeckOfCards class, we can utilize the Card class you created in Assignment 4 and add methods to manage a deck of cards. The UML Class diagram for DeckOfCards might look like:

+-----------------------------------+

|          DeckOfCards          |

+-----------------------------------+

| - cards: List<Card>           |

+-----------------------------------+

| + DeckOfCards()              |

| + shuffle()                         |

| + dealCard(): Card           |

| + cardsLeft(): int               |

| + toString(): String            |

+-----------------------------------+

The DeckOfCards class contains a List of Card objects, representing the deck. The constructor initializes the deck, and the shuffle method randomizes the order of cards. The dealCard method returns the top card and reduces the count of remaining cards. The cardsLeft method returns the count of remaining cards, and toString provides a string representation of the deck.

Here's a simplified implementation in Java:

import java.util.ArrayList;

import java.util.Collections;

import java.util.List;

public class DeckOfCards {

   private List<Card> cards;

   public DeckOfCards() {

       cards = new ArrayList<>();

       for (int suit = 1; suit <= 4; suit++) {

           for (int faceValue = 1; faceValue <= 13; faceValue++) {

               cards.add(new Card(suit, faceValue));

           }

       }

   }

   public void shuffle() {

       Collections.shuffle(cards);

   }

   public Card dealCard() {

       if (cards.isEmpty()) {

           return null; // Deck is empty

       }

       return cards.remove(0);

   }

   public int cardsLeft() {

       return cards.size();

   }

   public String toString() {

       StringBuilder deckString = new StringBuilder();

       for (Card card : cards) {

           deckString.append(card.toString()).append("\n");

       }

       return deckString.toString();

   }

}

For the driver class, you can create an instance of DeckOfCards, print the initial deck, shuffle it, and then deal and print each card from the shuffled deck.

The question probable maybe:

In Assignment 4, you created a Card class that represents a standard playing card. Use this to design and implement a class called DeckOfCards that stores 52 objects of the Card class. Include methods to shuffle the deck, deal a card, and report the number of cards left in the deck, and a toString to show the contents of the deck. The shuffle methods should assume a full deck. Document your design with a UML Class diagram. Create a separate driver class that first outputs the populated deck to prove it is complete, shuffles the deck, and then deals each card from a shuffled deck, displaying each card as it is dealt.

Hint: The constructor for DeckOfCards should have nested for loops for the face values (1 to 13) within the suit values (1 to 4). The shuffle method does not have to simulate how a deck is physically shuffled; you can achieve the same effect by repeatedly swapping pairs of cards chosen at random.

Let us assume that processor testing is done by filling the PC,registers, and data and instruction memories with some values(you can choose which values), letting a single instruction execute, then reading the PC, memories, and registers. These values are then examined to determine if a particular fault is present. Can you design a test (values for PC, memories, and registers) that would determine if there is a stuck-at-0 fault on this signal?

Answers

Answer:

See explaination for the details.

Explanation:

PC can be any valid value that is divisible by 4. In that case, lets pick 20000.

We can pick any instruction dat writes to a register. Lets pick addi.

The destination register number must be odd so that it has good value of 1. The opposite of the stock-add-value we want to test for. Lets go ahead and pick register 9.

Make register 9 have a value of 20 and register 9 jas a value of 25 prior to the add instruction.

addi. $9, zero, 22

When the value read from register 8 after the add instruction is 22, we know that we have found the fault.

Final answer:

A test to determine a stuck-at-0 fault in a CPU involves preloading specific values into the PC, registers, and instruction memory, executing an instruction, and checking if the expected values are reflected post-execution. A failure to update a signal from 0 suggests a stuck-at-0 fault. This test is part of the broader endeavor of programming and diagnostics within computer engineering.

Explanation:

To design a test that determines if there is a stuck-at-0 fault on a signal within a Central Processing Unit (CPU), one could start by setting the Program Counter (PC), registers, and memory to specific non-zero values, execute an instruction that would change the state of the signal in question, and then verify if the expected changes occur.

For instance, if testing a register expected to be set to a value of 1 by an instruction, you might initialize the instruction memory with an instruction like 'SET REGISTER' to the non-zero value, and the register itself with 0. Once the instruction executes, if the register does not reflect the value that was written to it, this suggests a possible stuck-at-0 fault. This kind of fault means that no matter what value is intended for that signal, it always reads as 0, which indicates a malfunctioning component inside the CPU.

A digital certificate system Group of answer choices uses third-party CAs to validate a user's identity. uses digital signatures to validate a user's identity. uses tokens to validate a user's identity. is used primarily by individuals for personal correspondence.

Answers

Answer: A. Uses third-party CA's to validate a users identity.

Explanation:

A digital certificate is a binding electronic document used in the exchange of messages between a sender and receiver across the internet. It is useful in validating the identities of all users so that none can deny either sending or receiving a message. It also offers some protection to the data sent and received.

Certification Authorities are recognized bodies who have the responsibility of ensuring the true identities of users. After achieving this they then issue a certificate that can serve as a guarantee. A public key is present in the certificate which only the true users can access.

These Certification Authorities would then confirm that the key and digital signature matches the identities of the users.

Answer:

uses third-party CAs to validate a user's identity.

Explanation:

Digital certificate is an electronic file which can be used to verify the identity of a party on the Internet. A digital certificate can be likened to an electronic passport of the internet.

It is issued by an organization called a certificate authority (CA).

A digital certificate system uses a trusted third party (certification authority), to validate a user's identity.

A marker automaton (MA) is a deterministic 1-tape 1-head machine with input alphabet {0, 1}. The head can move left or right but is constrained to the input portion of the tape. The machine has the ability to write only one new character to a cell, namely #. (a) Give an example of language D that is accepted by an MA but is not context-free. Justify your answer. (b) Show that Kma = { hM, wi : M is an MA accepting w } is recursive.

Answers

Answer:

See explaination

Explanation:

In our grammar for arithmetic expression, the start symbol is <expression>, so our initial string is:

<expression >

Using rule 5 we can choose to replace the nonterminal, producing the string:

<expression >*<expression >

We now have two nonterminals, to replace, we can apply rule three to the first nonterminal, producing the string:

<expression >+<expression>*<expression>

We can apply rule two to the remaining nonterminal, we get:

(number)+number*number

This is a valid arithmetic expression as generated by grammar.

Given a grammar G with start symbol S, if there is some sequence of production that when applied to the initial string S, result in the string s, then s is in L (G). the language of the grammar.

Other Questions
Write the first 5 terms of thesequence an = 3n 4 Use elimination to solve the system of equation4x+y=-23x+2y=6 Which description accurately describes the tide represented by the image below? Image of the sun and moon at a 90 degree angle to Earth. An oval is around Earth that points toward and away from the moon to show the tidal bulges. High tide Lunar tide Neap tide Spring tide R is inversely proportional to A.R = 12 when A = 1.5a) Work out the value of Rwhen A= 5.b) Work out the value of A when R = 9 Write an essay explaining What Risks in slaved people had to take In the cell which organelle has the function of using oxygen in the breakdown Moose Drool Makes Grass More AppetizingDifferent species can interact in interesting ways. One type of grass produces the toxin ergovaline at levels about 1.0 part per million in order to keep grazing animals away. However, a recent study27has found that the saliva from a moose counteracts these toxins and makes the grass more appetizing (for the moose). Scientists estimate that, after treatment with moose drool, mean level of the toxin ergovaline (in ppm) on the grass is 0.183. The standard error for this estimate is 0.016.Give notation for the quantity being estimated, and define any parameters used.Give notation for the quantity that gives the best estimate, and give its value.Give a 95% confidence interval for the quantity being estimated. Interpret the interval in context.3.68Bisphenol A in Your Soup CansBisphenol A (BPA) is in the lining of most canned goods, and recent studies have shown a positive association between BPA exposure and behavior and health problems. How much does canned soup consumption increase urinary BPA concentration? That was the question addressed in a recent study34in which consumption of canned soup over five days was associated with a more than 1000% increase in urinary BPA. In the study, 75 participants ate either canned soup or fresh soup for lunch for five days. On the fifth day, urinary BPA levels were measured. After a two-day break, the participants switched groups and repeated the process. The difference in BPA levels between the two treatments was measured for each participant. The study reports that a 95% confidence interval for the difference in means (canned minus fresh) is 19.6 to 25.5g/L.Is this a randomized comparative experiment or a matched pairs experiment? Why might this type of experiment have been used?What parameter are we estimating?Interpret the confidence interval in terms of BPA concentrations.If the study had included 500 participants instead of 75, would you expect the confidence interval to bewiderornarrower?3.70Effect of Overeating for One Month: Average Long-Term Weight GainOvereating for just four weeks can increase fat mass and weight over two years later, a Swedish study shows.35Researchers recruited 18 healthy and normal-weight people with an average age of 26. For a four-week period, participants increased calorie intake by 70% (mostly by eating fast food) and limited daily activity to a maximum of 5000 steps per day (considered sedentary). Not surprisingly, weight and body fat of the participants went up significantly during the study and then decreased after the study ended. Participants are believed to have returned to the diet and lifestyle they had before the experiment. However, two and a half years after the experiment, the mean weight gain for participants was 6.8 lbs with a standard error of 1.2 lbs. A control group that did not binge had no change in weight.What is the relevant parameter?How could we find the actual exact value of the parameter?Give a 95% confidence interval for the parameter and interpret it.Give the margin of error and interpret it. The combustion of 1.760 g of propanol (C3H7OH) increases the temperature of a bomb calorimeter from 298.00K to 302.15K. The heat capacity of the bomb calorimeter is 14.24 kJ/K. Determine H for the combustion of propanol to carbon dioxide gas and liquid water in kJ/mol. "h varies directly as u". If h = 8 when u = 40, find u when h = 25. A man bought a refrigerator, an air conditioner, a TV set and a gas cooker for $150.00, $400.00, $180.00 and $300.00 respectively. In addition he pays 15% VAT for each item. CalculateTotal VAT collected from himTotal amount he had to pay. What do you think would happen to the United States and to us if Jefferson or Hamilton did no exist? Increased urbanization leads to a phenomenon called What is the unit of measure for energy?O wattO newtonO joule0 meters per second Which answer choices list possible types of angles for this triangle? Select two that apply. Billy Ray owns several parcels of rental real estate, and he actively participates in managing the properties. His total loss from these activities in 2019 is $30,000 and his AGI for 2019 is $110,000. How much of the disallowed loss from rental real estate activities may be carried over to future years? Billy is an 11-year-old boy who was admitted to hospital with dehydration. His parents said that over the last few months, he had seemed tired and lacking in energy, and that despite eating well and drinking large quantities of fluids he had lost about 7 kg (15 lbs) in weight. He also seemed to be going to the toilet frequently, not only during the day but also during the night. On examination, there was evidence of dehydration (sunken eyes, loss of tissue turgor); his pulse rate was 115 BPM, blood pressure was 95/55 mmHg, respiratory rate was 20 breaths per minute, and his breath smelled of acetone.1. Comment on the history and findings following the physical examination of Billy.2. Comment on and interpret the test strip results. Are they consistent with your provisional diagnosis based on the history and physical examination findings? Where does 17 belong on the Venn diagram?A)IntegersB)Natural NumbersC)Rational NumbersD)Irrational NumbersREALLY NEED HELP I HAVE 8 MORE QUESTIONS PLS HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I WILL GIVE BRAINLIEST AND 10 POINTS These box plots show daily low temperatures for a sample of days in twodifferent towns. Which statement is the most appropriate comparison of the spreads? Please help me! greatly appreciated A Deaf person goes to a sports bar, and asks the manager to turn on the captions. The manager turns it on. After a few minutes, a hearing customer nearby asks the manager to turn off the captions. The manager turns it off. The Deaf person asks the manager to mute the TV. The manager laughs and mutes the TV. What is this called?