Questions
in c++ language This assignment is to give you practice using structs and sorting. In competitive...

in c++ language

This assignment is to give you practice using structs and sorting.

In competitive diving, each diver makes dives of varying degrees of difficulty. Nine judges score each dive from 0 through 10 in steps of 0.5. The difficulty is a floating-point value between 1.0 and 3.0 that represents how complex the dive is to perform. The total score is obtained by discarding the lowest and highest of the judges’ scores, adding the remaining scores, and then multiplying that total by the degree of difficulty. Write a program to score each of the dives, using the following input and output specifications, and determine the winner of the competition.

Input:

Create the file m7divers.txt using the data given at the end.

The first line contains an integer for the number of divers in the competition and subsequent lines contain:
Diver’s name (10 characters max, no blanks included), difficulty (double), and judges’ ratings (nine doubles). There is one line of data for each diver.

Example file: (This is not the data to use)

Anne 2.0 8.0 8.5 8.5 8.5 9.0 9.0 9.0 9.5 9.5 124.0
Sarah 1.6 7.0 7.5 8.0 8.0 8.0 8.5 8.5 8.5 9.0 91.2

Output:

The name and difficulty, followed by the scores sorted into increasing order, in tabular form with appropriate headings along with the earned total points for that dive.

Example for sample data above

NAME DIFF SORTED SCORES         POINTS
Anne 2.0 8.0 8.5 8.5 8.5 9.0 9.0 9.0 9.5 9.5 124.0
Sarah 1.6 7.0 7.5 8.0 8.0 8.0 8.5 8.5 8.5 9.0 91.2


At the end of the table, print out the name of the winner of the competition (the person with the highest points) and his/her final score.

Hint: Use functions to modularize your program.

Use this data for your input file. download the data from the attachment.

NAME DIFF SORTED SCORES        
Anne 2.0 8.0 8.5 8.5 8.5 9.0 9.0 9.0 9.5 9.5
Sarah 1.6 7.0 7.5 8.0 8.0 8.0 8.5 8.5 8.5 9.0
Deborah 2.3 9.0 9.0 9.5 10.0 10.0 9.5 9.5 9.5 9.5
Kathryn 2.4 9.0 9.0 9.0 9.5 9.5 9.5 9.0 8.0 8.5
Martha 2.7 9.0 9.0 9.5 9.5 9.0 8.5 8.5 8.5 8.5
Elizabeth 2.9 8.0 8.0 7.5 8.5 8.5 8.0 8.0 7.5 8.5
Tina 2.5 8.5 8.5 8.5 8.5 8.5 8.5 8.5 8.5 8.5

In: Computer Science

Write a program in PYTHON which: *Defines the following 5 functions: whoamI() This function prints out...

Write a program in PYTHON which:

*Defines the following 5 functions:

whoamI()

This function prints out your name and PRINTS OUT any programming course you have taken prior to this course.

isEven(number)

This function accepts one parameter, a number, and PRINTS OUT a message telling if the numberer is even or odd. Keep in mind that a number is even if there is no remainder when the number is divided by two.

printEven(number)

This function accepts one parameter, a number, and PRINTS OUT all even values from 2 thru this number.

sumUp(number)

This function accepts one parameter, a number, and RETURNS the sum of ALL values from 1 up to this number

howmanyDigits(number)

This function accepts one parameter, a number, and RETURNS the number of digits contained in the value. (for example, if the value was 475, the function would return a 3. Hint: the simplest way to do this is to convert the number to a string .. then the length is accessible

* follows the function definition with main process statements which:

1.) calls the 'whoamI' function to that the program begins by outputting uses information

2.) prompt the user for a positive int and store it

   If the user does not enter a valid number, reprompt. Continue this until a valid value

   has been entered.

3.) present the user with 4 choices:  

              -find out if the number is even or odd

              - printout all even values up to the number

              -output the sum of all values from one to the number

- output the number of digits in the number

4.) Carry out the user’s choice. Be sure to call one of the functions that you have defined to do this.

If you wish you may put the main statements in a loop that repeats until the user chooses to exit.  

In: Computer Science

Discuss several categories of common end-user technology problems. Provide examples of problem-solving processes applied to typical...

Discuss several categories of common end-user technology problems.

Provide examples of problem-solving processes applied to typical support problems.

In: Computer Science

This Code Is Supposed To Be Performed In JAVA 1.) Create an abstract class DiscountPolicy. It...

This Code Is Supposed To Be Performed In JAVA

1.) Create an abstract class DiscountPolicy. It should have a single abstract method computeDiscount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost. Create a driver class that tests this class and provide the UML.

2.) In a separate program, define DiscountPolicy as an interface instead of the abstract class. Create a driver class that tests this class and provide the UML.

Perform The Following

1.) Create an abstract class DiscountPolicy with a single abstract method computeDiscount that will return the discount for the purchase of a given number of a single item.

2.) Create a driver class

3.) Create an interface class DiscountPolicy with a single abstract method computeDiscount that will return the discount for the purchase of a given number of a single item.

4.) Create a driver class or use the same driver class that you created earlier

In: Computer Science

1. Enhance Binary System Conversion program with Lab05.2 Addition Function Write a program that accepts two...

1. Enhance Binary System Conversion program with Lab05.2 Addition Function Write a program that accepts two positive binary number in string and perform the addition with Lab05.2 function enhance in a way can accept binary string in addition to decimal string (use input parameter to control the base2 or base10 addition) and output the as binary string. (Optional: Demonstrate 8 bits and 16 bits in length as inputs.) // the example function prototype for addition function below where accepting two numbers, m, and base as input; output the addition result as string type as return value; base should be 2 or 10 as required. string addFunction(string numberA, string numberB, int m, int base); Requirement: C++ programing; program an addition algorithm function that can both accept binary and decimal addition; convert each other if necessary. ................................................................................................................................................................................................................

Requirement:

1. Write a string addFunction that both can accept two positive binary numbers and decimal numbers in string.

2. The example function prototype for addition function below where accepting two numbers,m, and base as input; output the addition result as string type as return value; base should be 2 or 10 as required.

3. Output needs as binary string.

4. Example for String addFuntion(string numberA, string number B, int m, int base).

Program language: C++

In: Computer Science

Use the substitution method to prove the solutions for the following recurrences: Recurrence Solution 1 T(n)...

Use the substitution method to prove the solutions for the following recurrences:

Recurrence

Solution

1

T(n) = T(n-1) + n

O(n­2)

2

T(n) = T(n/2) + 1

O(lgn)

3

T(n) = T(n/2) + n

ϴ(nlgn)

4

T(n) = 3T(n/2) + n

O(nlg(3)).

5

T(n) = 2T(n/2) + n2

O(n­2)

6

T(n) = 4T(n/2 + 2) + n

O(n­2)

7

T(n) = 2T(n – 1) + 1

O(2n)

8

T(n) = T(n – 1) + T(n/2) + n

O(2n)

9

T(n) = 4T(n/2) + cn.  

ϴ(n­2)

In: Computer Science

Write a C++ program that declares three one-dimensional arrays named miles, gallons and mpg. Each array...

Write a C++ program that declares three one-dimensional arrays named miles, gallons and mpg. Each array should be capable of holding 10 elements. In the miles array, store the numbers 240.5, 300.0 189.6, 310.6, 280.7, 216.9, 199.4, 160.3, 177.4 and 192.3. In the gallons array, store the numbers 10.3, 15,6, 8.7, 14, 16.3, 15.7, 14.9, 10.7 , 8.3 and 8.4. Each element of the mpg array should be calculated as the corresponding element of the miles array divided by the equivalent element of the gallons array: for example mpg[0]=miles[0]/gallons[0]. Use pointers when calculating and displaying the elements of the mpg array.

In: Computer Science

Research starting an online business selling goods. What are at least 5 things you need to...

  1. Research starting an online business selling goods. What are at least 5 things you need to make sure you understand before selling your first item online to be compliant with regulations? Explain each one of these and why they are important; including examples/scenarios.

In: Computer Science

Suppose you request a webpage that contains 10 images. Suppose the transmission time for a webpage...

  1. Suppose you request a webpage that contains 10 images. Suppose the transmission time for a webpage is 10ms, and the transmission time for an image is 5ms. Suppose that 10 images are located on 3 different servers: 5 of them are saved on marist.edu with the webpage, 2 are saved on nyu.edu, and 3 are saved on albany.edu.

Suppose the RTT between your host and marist.edu is 10 ms, between your host and nyu.edu is 20 ms, and between your host and albany.edu is 30 ms.

Assume parallel transmissions are not considered in this problem, that is, objects are obtained one after another.

a) How long does it take to load the entire webpage with HTTP 1.0?

b) How long does it take to load the entire webpage with HTTP 1.1?

In: Computer Science

list 5 history fact about professional conduct in computer science ( ex: stealing data, copyright, leaking...

list 5 history fact about professional conduct in computer science ( ex: stealing data, copyright, leaking data,....) and give a reason why you picked this for each fact.

In: Computer Science

In java. Determine the value of each of the following expressions. (Format your answer with two...

In java. Determine the value of each of the following expressions. (Format your answer with two decimal places.) a. Math.abs(-4) b. Math.abs(10.8) c. Math.abs(-2.5) d. Math.pow(3.2, 2) e. Math.pow(2.5, 3) f. Math.sqrt(25.0) g. Math.sqrt(6.25) h. Math.pow(3.0, 4.0) / Math.abs(-9) i. Math.floor(28.95) j. Math.ceil(35.2)

In: Computer Science

[15] Create a program called StreamingWords.java that modifies the StreamingIntegers.java from Task 1. The program should...

  1. [15] Create a program called StreamingWords.java that modifies the StreamingIntegers.java from Task 1. The program should be able to do the following: JAVA

    1. accepts user input. User inputs can be under the following forms:

      1. one or more words, separated by white space.

      2. User can provide multiple inputs (each input is completed after user hits Enter)

      3. To stop inputting data, user will enter END then hit Enter.

    2. reads inputs from users into a queue data structure. Each data element in the queue contains one sentence (from whence user starts typing until they hit Enter)

    3. Once users finish entering input (END has been read), the program should begin remove the queue from the front, printing out the data elements in the queue.  

    4. The data elements should be printed out already sorted based on the number of words each element contains, regardless of the order of arrival or the total length of the characters. Each data element is to be printed on one line, and words within a data element are separated by a single white space.

In: Computer Science

A program called i2b.c was implemented with the intention to provide a binary representation of an...

A program called i2b.c was implemented with the intention to provide a binary representation of an integer. Unfortunately, the implementation has the following limitation:

  • It was hard-coded to only convert a single number.
  • The conversion algorithm only works for positive number.

Modify the existing source code of i2b.c such that:

  • i2b.c can now accept a single command line argument. This command line argument is assumed to be a valid signed integer.
  • i2b.c will convert the command line argument into its corresponding binary representation with the following condition:
    • The representation is an array of integers.
    • This array has a length of 32.
    • This array contains the binary representations of the integer argument.
    • Index 0 contains the most significant bit, and index 31 contains the least significant bit.
  • i2b.c will print out the final binary representation on a single line without any space between the bits.

PROGRAM BELOW

#include <stdio.h>

#define N 32

int main(int argc, char *argv[]) {

  int n = 12345;

  int binRep[N];

  int i;

  for (i = 0; i < N; i++) {

    binRep[i] = 0;

  }

  i = 0;

  while (n > 0) {

    binRep[i] = n % 2;

    n = n / 2;

    i++;

  }

  for (i = N - 1; i >= 0; i--) {

    printf("%d", binRep[i]);

  }

  printf("\n");

  return 0;

}

In: Computer Science

Create a console application named TakeHomePay.cs under your homework directory (please refer to the earlier recorded...

Create a console application named TakeHomePay.cs under your homework directory (please refer to the earlier recorded Zoom sessions if you are not sure how to do it) that calculates the take-home pay for an employee. The two types of employees are salaried and hourly. Allow the user to input the employee’s first and last name, id, and type. If an employee is salaried, allow the user to input the salary amount. If an employee is hourly, allow the user to input the hourly rate and the number of hours clocked for the week. For hourly employees, overtime is paid for hours over 40 at a rate of 1.5 of the base rate. For all employees’ take-home pay, federal tax of 18% is deducted. A retirement contribution of 10% and a Social Security tax rate of 6% should also be deducted. Use appropriate constants and decision making structures.

In: Computer Science

Compare the strengths and weaknesses of SQL and NoSQL Databases. 1. What´s the meaning of each...

Compare the strengths and weaknesses of SQL and NoSQL Databases.

1. What´s the meaning of each and how they work and store data. 2. In which scenarios is better to use one or the other. 3. What are the different types of SQL and NoSQL Databases. 4. What are the advantages of NoSQL over traditional SQL Databases. 5. When to use a NoSQL database instead of a relational database? 6. Which one is more scalable and flexible and in which scenarios. 7. Explain the use of transactions in SQL and NoSQL Databases. 8. Provide good examples on each. 9. Provide a good conclusion.

In: Computer Science