Questions
use c++ (1) Prompt the user for a title for data. Output the title. (1 pt)...

use c++

(1) Prompt the user for a title for data. Output the title. (1 pt)

Ex:

Enter a title for the data:
Number of Novels Authored
You entered: Number of Novels Authored


(2) Prompt the user for the headers of two columns of a table. Output the column headers. (1 pt)

Ex:

Enter the column 1 header:
Author name
You entered: Author name

Enter the column 2 header:
Number of novels
You entered: Number of novels


(3) Prompt the user for data points. Data points must be in this format: string, int. Store the information before the comma into a string variable and the information after the comma into an integer. The user will enter -1 when they have finished entering data points. Output the data points. Store the string components of the data points in a vector of strings. Store the integer components of the data points in a vector of integers. (4 pts)

Ex:

Enter a data point (-1 to stop input):
Jane Austen, 6
Data string: Jane Austen
Data integer: 6


(4) Perform error checking for the data point entries. If any of the following errors occurs, output the appropriate error message and prompt again for a valid data point.

  • If entry has no comma
    • Output: Error: No comma in string. (1 pt)
  • If entry has more than one comma
    • Output: Error: Too many commas in input. (1 pt)
  • If entry after the comma is not an integer
    • Output: Error: Comma not followed by an integer. (2 pts)


Ex:

Enter a data point (-1 to stop input):
Ernest Hemingway 9
Error: No comma in string.

Enter a data point (-1 to stop input):
Ernest, Hemingway, 9
Error: Too many commas in input.

Enter a data point (-1 to stop input):
Ernest Hemingway, nine
Error: Comma not followed by an integer.

Enter a data point (-1 to stop input):
Ernest Hemingway, 9
Data string: Ernest Hemingway
Data integer: 9


(5) Output the information in a formatted table. The title is right justified with a setw() value of 33. Column 1 has a setw() value of 20. Column 2 has a setw() value of 23. (3 pts)

Ex:

        Number of Novels Authored
Author name         |       Number of novels
--------------------------------------------
Jane Austen         |                      6
Charles Dickens     |                     20
Ernest Hemingway    |                      9
Jack Kerouac        |                     22
F. Scott Fitzgerald |                      8
Mary Shelley        |                      7
Charlotte Bronte    |                      5
Mark Twain          |                     11
Agatha Christie     |                     73
Ian Flemming        |                     14
J.K. Rowling        |                     14
Stephen King        |                     54
Oscar Wilde         |                      1


(6) Output the information as a formatted histogram. Each name is right justified with a setw() value of 20. (4 pts)

Ex:

         Jane Austen ******
     Charles Dickens ********************
    Ernest Hemingway *********
        Jack Kerouac **********************
 F. Scott Fitzgerald ********
        Mary Shelley *******
    Charlotte Bronte *****
          Mark Twain ***********
     Agatha Christie *************************************************************************
        Ian Flemming **************
        J.K. Rowling **************
        Stephen King ******************************************************
         Oscar Wilde *

In: Computer Science

9.6 Ch 9 Program: Data visualization (in C) (1) Prompt the user for a title for...

9.6 Ch 9 Program: Data visualization (in C)

(1) Prompt the user for a title for data. Output the title. (1 pt)

Ex:

Enter a title for the data:
Number of Novels Authored
You entered: Number of Novels Authored


(2) Prompt the user for the headers of two columns of a table. Output the column headers. (1 pt)

Ex:

Enter the column 1 header:
Author name
You entered: Author name

Enter the column 2 header:
Number of novels
You entered: Number of novels


(3) Prompt the user for data points. Data points must be in this format: string, int. Store the information before the comma into a string variable and the information after the comma into an integer. The user will enter -1 when they have finished entering data points. Output the data points. Store the string components of the data points in an array of strings. Store the integer components of the data points in an array of integers. (4 pts)

Ex:

Enter a data point (-1 to stop input):
Jane Austen, 6
Data string: Jane Austen
Data integer: 6


(4) Perform error checking for the data point entries. If any of the following errors occurs, output the appropriate error message and prompt again for a valid data point.

  • If entry has no comma
    • Output: Error: No comma in string. (1 pt)
  • If entry has more than one comma
    • Output: Error: Too many commas in input. (1 pt)
  • If entry after the comma is not an integer
    • Output: Error: Comma not followed by an integer. (2 pts)


Ex:

Enter a data point (-1 to stop input):
Ernest Hemingway 9
Error: No comma in string.

Enter a data point (-1 to stop input):
Ernest, Hemingway, 9
Error: Too many commas in input.

Enter a data point (-1 to stop input):
Ernest Hemingway, nine
Error: Comma not followed by an integer.

Enter a data point (-1 to stop input):
Ernest Hemingway, 9
Data string: Ernest Hemingway
Data integer: 9


(5) Output the information in a formatted table. The title is right justified with a width of 33. Column 1 has a width of 20. Column 2 has a width of 23. (3 pts)

Ex:

        Number of Novels Authored
Author name         |       Number of novels
--------------------------------------------
Jane Austen         |                      6
Charles Dickens     |                     20
Ernest Hemingway    |                      9
Jack Kerouac        |                     22
F. Scott Fitzgerald |                      8
Mary Shelley        |                      7
Charlotte Bronte    |                      5
Mark Twain          |                     11
Agatha Christie     |                     73
Ian Flemming        |                     14
J.K. Rowling        |                     14
Stephen King        |                     54
Oscar Wilde         |                      1


(6) Output the information as a formatted histogram. Each name is right justified with a width of 20. (4 pts)

Ex:

         Jane Austen ******
     Charles Dickens ********************
    Ernest Hemingway *********
        Jack Kerouac **********************
 F. Scott Fitzgerald ********
        Mary Shelley *******
    Charlotte Bronte *****
          Mark Twain ***********
     Agatha Christie *************************************************************************
        Ian Flemming **************
        J.K. Rowling **************
        Stephen King ******************************************************
         Oscar Wilde *

In: Computer Science

Please note that this problem have to use sstream library in c++ (1) Prompt the user...

Please note that this problem have to use sstream library in c++

(1) Prompt the user for a title for data. Output the title. (1 pt)

Ex:

Enter a title for the data:
Number of Novels Authored
You entered: Number of Novels Authored


(2) Prompt the user for the headers of two columns of a table. Output the column headers. (1 pt)

Ex:

Enter the column 1 header:
Author name
You entered: Author name

Enter the column 2 header:
Number of novels
You entered: Number of novels


(3) Prompt the user for data points. Data points must be in this format: string, int. Store the information before the comma into a string variable and the information after the comma into an integer. The user will enter -1 when they have finished entering data points. Output the data points. Store the string components of the data points in a vector of strings. Store the integer components of the data points in a vector of integers. (4 pts)

Ex:

Enter a data point (-1 to stop input):
Jane Austen, 6
Data string: Jane Austen
Data integer: 6


(4) Perform error checking for the data point entries. If any of the following errors occurs, output the appropriate error message and prompt again for a valid data point.

  • If entry has no comma
    • Output: Error: No comma in string. (1 pt)
  • If entry has more than one comma
    • Output: Error: Too many commas in input. (1 pt)
  • If entry after the comma is not an integer
    • Output: Error: Comma not followed by an integer. (2 pts)


Ex:

Enter a data point (-1 to stop input):
Ernest Hemingway 9
Error: No comma in string.

Enter a data point (-1 to stop input):
Ernest, Hemingway, 9
Error: Too many commas in input.

Enter a data point (-1 to stop input):
Ernest Hemingway, nine
Error: Comma not followed by an integer.

Enter a data point (-1 to stop input):
Ernest Hemingway, 9
Data string: Ernest Hemingway
Data integer: 9


(5) Output the information in a formatted table. The title is right justified with a setw() value of 33. Column 1 has a setw() value of 20. Column 2 has a setw() value of 23. (3 pts)

Ex:

        Number of Novels Authored
Author name         |       Number of novels
--------------------------------------------
Jane Austen         |                      6
Charles Dickens     |                     20
Ernest Hemingway    |                      9
Jack Kerouac        |                     22
F. Scott Fitzgerald |                      8
Mary Shelley        |                      7
Charlotte Bronte    |                      5
Mark Twain          |                     11
Agatha Christie     |                     73
Ian Flemming        |                     14
J.K. Rowling        |                     14
Stephen King        |                     54
Oscar Wilde         |                      1


(6) Output the information as a formatted histogram. Each name is right justified with a setw() value of 20. (4 pts)

Ex:

         Jane Austen ******
     Charles Dickens ********************
    Ernest Hemingway *********
        Jack Kerouac **********************
 F. Scott Fitzgerald ********
        Mary Shelley *******
    Charlotte Bronte *****
          Mark Twain ***********
     Agatha Christie *************************************************************************
        Ian Flemming **************
        J.K. Rowling **************
        Stephen King ******************************************************
         Oscar Wilde *

In: Computer Science

I cannot figure out why my random name generator isn't producing the letter u or z....

I cannot figure out why my random name generator isn't producing the letter u or z. Can someone help me out? The language is java.

import java.util.Random;

public class BrandName {

   public static void main(String[] args) {
       Random random = new Random();
       System.out.println("Brand Name Generator - Michael Wikstrom\n");
       char odd[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y',
               'z' };
       char even[] = { 'a', 'e', 'i', 'o', 'u' };

       for (int i = 1; i <= 10; i++) {

           int length = random.nextInt(4) + 8;
           String name = " ";
           for (int j = 0; j < length; j++) {
               if (j == 0) {
                   int pos = random.nextInt(odd.length - 1);
                   name += Character.toUpperCase(odd[pos]);

               } else if (j % 2 == 1) {
                   int pos = random.nextInt(even.length - 1);
                   name += even[pos];
               } else {
                   int pos = random.nextInt(odd.length - 1);
                   name += odd[pos];
               }
           }

           System.out.println(i + ") " + name);

       }
   }

}

In: Computer Science

A Lecturer wishes to create a program that lists his students sorted by the number of...

A Lecturer wishes to create a program that lists his students sorted by the number of theory assignment marks they have completed. The listing should be greatest number of assignment first, sub-sorted by name in lexicographical order (A to Z). A class Student stores the name and marks of assignment completed for a student.                                                    [5 marks]

Note: Assume the variable name of collection is list.

      i.         Provide a definition of Student with an equals() method. The comparison is based on name of the student.                                                                                     [3 marks]

    ii.         Write java statement to declare a collection variable list of type Student             [2 marks]

   iii.         Implements interface Comparator such that fulfil a natural ordering that matches the given requirement. Define method compareTo() such that it compares based on greatest number of assignment first, sub-sorted by name in lexicographical order (A to Z)). [5 marks]

   iv.         Provide definition of find(String) method which returns the index if given name exists in collection.                                                                                                     [2 marks]

     v.         Provide a static method in application class to display all students by calling toString method. Assume the name of object of collection is list.                             [4 marks]

In: Computer Science

Consider the experimental results for the following randomized block design. Tasks A B C Individuals 1...

Consider the experimental results for the following randomized block design.

Tasks

A

B

C

Individuals

1

10

9

8

2

12

6

5

3

18

15

14

4

20

18

18

5

8

7

8

Suppose that you have an experiment wherein 5 individuals are each receiving training on 3 different tasks (A, B, and C). The values represent the number of minutes taken to complete the task. Suppose further that we are interested in determining whether there is a significant difference in the mean time taken to complete each of the tasks or not. State the name of the design of this experiment and all of the hypotheses that you would test. (Do NOT test.)

Type of test:

Hypotheses:

In: Statistics and Probability

Identification of a Communication Theory: Uncertainty Reduction Theory Meta-theoretical Assumptions: How would the author of your...

Identification of a Communication Theory: Uncertainty Reduction Theory

Meta-theoretical Assumptions: How would the author of your theory define communication? Which of the 7 issues in defining communication discussed in class would be most important to the author of your theory? How do you know?

In: Operations Management

A restaurant association says the typical household in the U.S. spends a mean of $2600 per...

A restaurant association says the typical household in the U.S. spends a mean of $2600 per year on food away from home. An author of a national travel publication tests this claim and calculated a p-value of 0.8215. What conclusion can this author make at the 0.05 level of significance?

In: Statistics and Probability

How to display in SQL Server, for example, all the author First Names are FIVE LETTERS...

How to display in SQL Server, for example, all the author First Names are FIVE LETTERS LONG if I have the Author Table.

I used the WHERE LENGTH ua_fname=5  

This is not returning names with 5 letters. Can someone please suggest to me the correct one?

In: Computer Science

1a) A survey was conducted to estimate the prevalence of a disease among a student population....

1a) A survey was conducted to estimate the prevalence of a disease among a student population. What type of epidemiological study is this?

Case-control

Cluster randomized trial

Longitudinal

Cross-sectional

Cohort

1b) Would this type of study be affected by selection bias? How?

1c) Would such bias affect prevalence estimate? How?

In: Biology