2:31ll LTE 43 - Chapter 8 lab 2.pdfCPS 229f 1Chapter 8 – Lab 22020Research and select an example of real life data which can be represented in a 2dimensional array.Write a program which does the following (name=xxx_and_xxx_lab2):1) Create a 2 dim array containing the information using an initializer list.2) If you have additional information which needs to be printed related to the data, youcan use other variables to store the information. For example, consider the tablebelow:4: TOP 10 MAJORS WITH HIGHEST CONCENTRATION OF MENPercent WomenPercent MenNaval Architecture and Marine Engineering397Mechanical Engineering Related TechnologiesMilitary Technologies9493Construction Services8.92Electrical and Mechanic Repairs And TechnologiesNuclear Engineering9191Industrial Production Technologies9.91Mechanical EngineeringMining and Mineral Engineering1090109010Electrical Engineering Technology90A two dim table with 10 rows and 2 columns can be used to represent the percent ofwomen and percent of men for each major.The name of the majors can be stored in a one dimensional array of Strings.There are other better ways to represent the information but for now this will donicely.3) The program should print a line explaining what the data in the array represents.4) Print the information in table format.5) In a comment, cite the source of the informationPlease do not use the table in my example

Question
Asked Feb 4, 2020
17 views
2:31
ll LTE 4
3 - Chapter 8 lab 2.pdf
CPS 229f 1
Chapter 8 – Lab 2
2020
Research and select an example of real life data which can be represented in a 2
dimensional array.
Write a program which does the following (name=xxx_and_xxx_lab2):
1) Create a 2 dim array containing the information using an initializer list.
2) If you have additional information which needs to be printed related to the data, you
can use other variables to store the information. For example, consider the table
below:
4: TOP 10 MAJORS WITH HIGHEST CONCENTRATION OF MEN
Percent Women
Percent Men
Naval Architecture and Marine Engineering
3
97
Mechanical Engineering Related Technologies
Military Technologies
94
93
Construction Services
8.
92
Electrical and Mechanic Repairs And Technologies
Nuclear Engineering
91
91
Industrial Production Technologies
9.
91
Mechanical Engineering
Mining and Mineral Engineering
10
90
10
90
10
Electrical Engineering Technology
90
A two dim table with 10 rows and 2 columns can be used to represent the percent of
women and percent of men for each major.
The name of the majors can be stored in a one dimensional array of Strings.
There are other better ways to represent the information but for now this will do
nicely.
3) The program should print a line explaining what the data in the array represents.
4) Print the information in table format.
5) In a comment, cite the source of the information
Please do not use the table in my example
help_outline

Image Transcriptionclose

2:31 ll LTE 4 3 - Chapter 8 lab 2.pdf CPS 229f 1 Chapter 8 – Lab 2 2020 Research and select an example of real life data which can be represented in a 2 dimensional array. Write a program which does the following (name=xxx_and_xxx_lab2): 1) Create a 2 dim array containing the information using an initializer list. 2) If you have additional information which needs to be printed related to the data, you can use other variables to store the information. For example, consider the table below: 4: TOP 10 MAJORS WITH HIGHEST CONCENTRATION OF MEN Percent Women Percent Men Naval Architecture and Marine Engineering 3 97 Mechanical Engineering Related Technologies Military Technologies 94 93 Construction Services 8. 92 Electrical and Mechanic Repairs And Technologies Nuclear Engineering 91 91 Industrial Production Technologies 9. 91 Mechanical Engineering Mining and Mineral Engineering 10 90 10 90 10 Electrical Engineering Technology 90 A two dim table with 10 rows and 2 columns can be used to represent the percent of women and percent of men for each major. The name of the majors can be stored in a one dimensional array of Strings. There are other better ways to represent the information but for now this will do nicely. 3) The program should print a line explaining what the data in the array represents. 4) Print the information in table format. 5) In a comment, cite the source of the information Please do not use the table in my example

fullscreen
check_circle

Expert Answer

star
star
star
star
star
1 Rating
Program -

#include <iostream>
#include <iomanip> // to access setw()

using namespace std;

int main()
{
    // array of the strings
    string branch[] = {"Naval Architecture and Marine Engineering",
                        "Mechanical Engineering Related Techonologies",
                        "Military Techonologies",
                        "Construction Services",
                        "Electrical and Mechanical Repairs And Techonologies",
                        "Nuclear Engineering",
                        "Industrial Production Techonologies",
                        "Mechanical Engineering",
                        "Mining and Mineral Engineering",
                        "Electrical Engineering Techonology"};

    // 2D array                        
    int percent[10][2] = {{3, 97},
                          {6, 94},
                          {7, 93},
                          {8, 92},
                          {9, 91},
                          {9, 91},
                          {9, 91},
                          {10, 90},
                          {10, 90},
                          {10, 90}};
                        
    int i, j; // variables to iterate the loop
    
    // printing the data
    cout << setw(65) << "\t\t\tPercent Women \tPercent Men" << endl;
    for (i = 0; i < 10; i++)
    {
        cout << left << setw(55) << branch[i];
        cout << "\t\t";
        for (j = 0; j < 2; j++)
        {
            cout << left << setw(15) << percent[i][j];
            if(j==1)
            {
                // new line
                printf("\n");
            }
        }
    }

    return 0;
}

Program description -
  • A string array branch is taken for the branches.
  • A 2D array percent is taken for the values of the table.
  • Two variables (i and J)are taken for the loop iteration.
  • In the nested loop, data i...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: Write a method that takes a given string and replaces all occurrences of one string with another str...

A: The given criteria is written in Java programming language as follows,File name: “ReplaceStr.java”//...

question_answer

Q: Why are technologies like fixed wireless and satellite networks important in rural networks?

A: Definition:Fixed wireless network –Communication systems or devices connects two fixed places wirele...

question_answer

Q: Write a very simple class definition in PHP.

A: Class:A class is a collection of objects with its own properties and behaviors.A programmer can defi...

question_answer

Q: Design a class named Employee. The class should keep the following information infields:• Employee n...

A: Program:Filename: “Test.java”public class Test{   public static void main(String args[])   {    Prod...

question_answer

Q: Write a program in python that creates a list of your friends. Start with an empty list and then us...

A: The below given python program will obey the following rubrics:Creating an empty list, friend_list.T...

question_answer

Q: What is the Big Oh runtime for the following function in terms of n? Show your work.   int recurse(i...

A: Big Oh runtime:Now, the condition if(n==0) makes a comparison and if n = 0, the value 1 is returned....

question_answer

Q: Provide the object reference to the second element within the first web form.   this is javascript p...

A: Assuming here that form has main element having id “parentElement” so “children[0].children[1]” will...

question_answer

Q: ( write in c language) write A program that inputs three different integers from the keyboard , then...

A: A C program for the given criteria is as follows,File name: “main.c”#include &lt;stdio.h&gt;int main...

question_answer

Q: Describe the difference in a signed and unsigned binary representation?

A: Difference between signed and unsigned binary numbers: