Questions
what is Object-oriented modeling? what is UML modeling? What is the different between Object-oriented modelling and...

what is Object-oriented modeling?

what is UML modeling?

What is the different between Object-oriented modelling and UML

In: Computer Science

Please execute the appropriate Unix command to perform the action described. 1 - Put your login...

Please execute the appropriate Unix command to perform the action described.

1 - Put your login name in the file session03_hw.

2 - Put the date in mm/dd/yy format in the file session03_hw.

3 - Put the abbreviated weekday name in the file session03_hw.

4 - Put the time in hh:mm format in the file session03_hw.

5 - Use the command for a short listing with the option to list entries by columns.
List files that start with mno and add the output to the file session03_hw.

6 - Use the command for a short listing of all files that have the last character as number 3 and
add the output to the file session03_hw.

7 - Use the command for a short listing of all files that have the second to last character as the letter i
and add the output to the file session03_hw.

8 - Concatenate the files that have the second to last character in the file name in the list a c e g i k and
the last character as a 1. Add the output to the file session03_hw.

9 - I want you to use the man command to find a command to determine a file type.
The man command with the -k keyword option will display all commands. I want you to display only
commands in chapter 1 of the Unix man pages. Add the output of what is displayed to the
file session03_hw.

10 - From the list of commands that is displayed from the step above, add only the line of the
command you think is the correct command to the file session03_hw.

11 - Concatenate the files mno.d1, mno.a7 and mno.b6. Add the output of any error messages to
the file session03_hw

12 - Create a file called theend with the words "The End" in the file. Add the contents of the
file theend to the file session03_hw.

13 - Use the command for a short listing with the option to list entries by columns of all the files in
your directory and add the output to session03_hw.

3. Look over the file session03_hw and check that it looks like what you would expect based on the
commands you have executed. For each question above, you should see your answer in the file session03_hw. If you do not see all your answers, you need to either redo the assignment or ask a question.

In: Computer Science

A certain programming language allows only two-character variable names. The first character must be a letter...

A certain programming language allows only two-character variable names. The first character must be a letter (upper or lower case) and the second character can be a letter (upper or lower case) or a digit. How many possible variable names are there?

In: Computer Science

c++ Run the following sorting algorithms: 1. Bubble sort 2. Insertion sort 3. Quicksort 4. Mergesort...

c++

Run the following sorting algorithms:
1. Bubble sort
2. Insertion sort
3. Quicksort
4. Mergesort
Under the following scenarios for input data:
1. Uniform random
2. Almost sorted (90% sorted – 1 in 10 is out of place)
3. Reverse sorted
On data of sizes 5,000, 10,000, … in increments of 5,000 up to …, 50,000

-Attach a screenshot of a program compilation below

-Attach a screenshot of a successful program run below

-Attach a graph (either line graph or bar graph) below.

3.2 90% Sorted Data (10% of data are out of their sorted position)
--Attach a graph below
3.3 Reverse-Sorted (sorted in non-increasing order) Data
--Attach a graph below

template code:

  • //a main template file

    #include <iostream>
    #include <iomanip>
    #include <ctime>
    #include <string>
    #include "Sort.h"

    using namespace std;

    void init_and_run(double**, int*, const int, const int, const int, const int);
    void print(double**, int*, const int, const int, const int, const int);

    int main()
    {

    int size[] = {100, 1000, 5000, 10000, 50000};
    const int NUM_SIZES = 7;
    const int NUM_SORT_ALGO = 7;
    const int NUM_DATA_TYPES = 3;
    const int NUM_REPEAT = 5;

    double* totalSortTime[NUM_DATA_TYPES];


    init_and_run(totalSortTime, size, NUM_SIZES, NUM_DATA_TYPES, NUM_SORT_ALGO, NUM_REPEAT);
    print(totalSortTime, size, NUM_SIZES, NUM_DATA_TYPES, NUM_SORT_ALGO, NUM_REPEAT);

    return 0;

    }

    void init_and_run(double**totalSortTime, int* size, const int NUM_SIZES, const int NUM_DATA_TYPES, const int NUM_SORT_ALGO, const int NUM_REPEAT)

    {

    clock_t time;

    for(int d = 0; d < NUM_DATA_TYPES; d++) {
    totalSortTime[d] = new double [NUM_SIZES * NUM_SORT_ALGO];
    for(int i = 0; i < NUM_SIZES * NUM_SORT_ALGO; i++)
    totalSortTime[d][i] = 0;
    }


    for(int d = 0; d < NUM_DATA_TYPES; d++) { //data types
    for(int s = 0; s < NUM_SIZES; s++) { //input sizes
    for(int r = 0; r < NUM_REPEAT; r++) { //repetitions
    Sort st(size[s], d);
    for(int t = 0; t < NUM_SORT_ALGO; t++) { //sort algorithms
    st.setSortType(t);
    time = clock();
    st.run();
    //st.print();
    time = clock() - time;
    totalSortTime[d][s * NUM_SORT_ALGO + t] += time;
    }
    }
    }
    }

    for(int d = 0; d < NUM_DATA_TYPES; d++) {
    delete [] totalSortTime[d];

    }
    }
    void print(double**totalSortTime, int* size, const int NUM_SIZES, const int NUM_DATA_TYPES, const int NUM_SORT_ALGO, const int NUM_REPEAT)
    {
    //cout << string(25, '=') << " AVG SORTING TIME " << string(25, '=') << endl;
    cout << "\nEach value displayed below shows the average sorting time with five instances.\n";
    cout << "The values may vary depending on the system and the implementation.\n";
    cout << "The relative performances, however, should be the same.\n";
    cout << "So are the performances of those algorithms as N or % of sorted numbers grows." << endl;

    string dataType[NUM_DATA_TYPES] = {
    " RANDOM_TBL_SIZE ",
    // " TBL_SIZE_PARTIAL_SORT_25 ",
    // " TBL_SIZE_PARTIAL_SORT_50 ",
    // " TBL_SIZE_PARTIAL_SORT_75 ",
    " TBL_SIZE_PARTIAL_SORT_95 ",
    " REVERSE_SORTED "
    };

    string sortAlgo[NUM_SORT_ALGO] = {
    "INSERTION",
    "MERGESORT",
    "QUICKSORT_L",
    "QUICKSORT_R",
    "COUNTING"
    "BUBBLE",
    "SELECTION"
    };


    cout << fixed << setprecision(2) << endl;
    for(int d = 0; d < NUM_DATA_TYPES; d++) {
    cout << string(25, '-') << left << setw(26) << dataType[d] << string(25, '-') << endl;
    cout << right << setw(7) << "N";
    for(int a = 0; a < NUM_SORT_ALGO; a++)
    cout << right << setw(14) << sortAlgo[a];
    cout << endl;

    for(int s = 0; s < NUM_SIZES; s++) {
    cout << right << setw(7) << size[s];
    for(int t = 0; t < NUM_SORT_ALGO; t++)
    cout << right << setw(14) << totalSortTime[d][s * NUM_SORT_ALGO + t]/NUM_REPEAT;
    cout << endl;
    }
    cout << endl;
    }
    }

  • //DATAGEN_H template file


    #ifndef DATAGEN_H
    #define DATAGEN_H

    class DataGen {
    private:
    int modType;
    int sortType;
    int dataType;

    int** data;
    int inputSize;
    int arraySize;
    int partialSortSize;

    void getRandom();
    void copy();
    void partialSort();
    public:
    DataGen();
    DataGen(int*[], int, int, int);
    void generateData();
    //void partialSort();

    };

    #endif

  • //DataGen.h template file


    #include "DataGen.h"

    class Sort
    {
    friend class DataGen;
    private:
    int* numbers[5];
    int algo_types;
    int size;
    DataGen *dg;

    void (Sort::*fp) ();
    void insertionSort();
    void bubbleSort();
    void selectionSort();

    void mergeSort();
    void quickSort_L();
    void quickSort_R();
    void countingSort();

    void partition_L(int, int, int&, int&);
    void partition_R(int, int, int&, int&);

    void merge(int, int, int[]);
    void recursive_mergeSort(int, int, int[]);
    void recursive_quickSort_L(int, int);
    void recursive_quickSort_R(int, int);

    void clear();
    public:
    Sort(int, int);
    ~Sort();
    void setSortType(int);
    void run();
    void print();
    };
    #endif

In: Computer Science

Write a two paragraph description of hashing that a non-technical user could understand .

Write a two paragraph description of hashing that a non-technical user could understand .

In: Computer Science

JAVA Write a program that demonstrates how various exceptions are caught with catch (Exception exception) This...

JAVA

Write a program that demonstrates how various exceptions are caught with

catch (Exception exception)

This time, define classes ExceptionA (which inherits from class Exception) and ExceptionB (which inherits from class ExceptionA). In your program, create try blocks that throw exceptions of types ExceptionA, ExceptionB, NullPointerException and IOException. All exceptions should be caught with catch blocks specifying type Exception.

In: Computer Science

(SQL Coding) Create a read only view called view_emp_salary_rank_ro that selects the last name and salary...

(SQL Coding)

Create a read only view called view_emp_salary_rank_ro that selects the last name and salary from the o_employees table and ranks the salaries from highest to lowest for the top three employees.

In: Computer Science

Write a program with two input values, Hours and Rate. The program should first calculate Gross...

Write a program with two input values, Hours and Rate. The program should first calculate Gross pay, which is your pay before deductions. The program should then calculate the following three deduction amounts: Federal Tax (20% of Gross), State Tax (5% of Gross), Social Security Tax (6.2% of Gross). Then your program should calculate Net pay, which is your Gross pay minus the three deductions. The output should be all five of the calculated values.

In: Computer Science

JAVA PROGRAM, Create the game "Rock, Scissor, Paper": Make the AI pick randomly. You need to...

JAVA PROGRAM, Create the game "Rock, Scissor, Paper":

  1. Make the AI pick randomly. You need to look up Random numbers in Java.
  2. First ask the user what language they want to play in. Choice 1 is English, but choice 2 can be whatever real language you want.
  3. Your first loop is making sure they enter good input.
  4. If there is a tie you don't give them the option to play again. They have to.
  5. Outer loop runs until they say they don't want to play again.
  6. Display how many wins and losses the player had only after they quit. Remember, variables are free. If you need the computer to keep track of something, make a variable.

In: Computer Science

For each of the following scenarios / consumers, to which type of Cloud service model is...

For each of the following scenarios / consumers, to which type of Cloud service model is it best suited?
1) Using Cloud storage for long-term archiving of financial records.

2) Outsourcing an organization’s VoIP IT systems to public Cloud providers.

In: Computer Science

Program 3: Command Line Calculator Topics: Functions or methods, global variables Overview You will build a...

Program 3: Command Line Calculator

Topics: Functions or methods, global variables

Overview

You will build a simple command line calculator. It supports addition (add), subtraction (sub), multiplication (mul), division (div), and calculation of the absolute value (abs). You will use functions to support each type of calculation. You can assume that the numbers are float data types.

Software Specifications

The user interacts with program by entering a command, followed by some parameters at the command prompt “>”. For example, if the user wants to add 4 and 5, he/she enters “add 4 5” and hits the return key. The system then outputs the result of the addition command (in this case, 9).   See sample run output below for more examples.

Once the command’s operation is completed, the system goes back to the command prompt waiting for another command from the user.   The commands are “add”, “sub”, “mul”, “div”, and “abs”. All the commands take two arguments except for “abs” which takes one argument. Each command will call the corresponding function to perform the calculation. Name each function the same name as the command. The “quit” command calls the printStats function and ends the program. The printStats function prints the number of times each function were called (executed). To keep track of function call usage, you will need global variables which can be shared across functions.

Command

# of arguments

Behavior

add

2

Adds the two arguments.

sub

2

Subtracts the second argument from the first argument.

mul

2

Multiplies the two arguments.

div

2

Divides the first argument by the second argument.

If the second argument is 0, print “Error: Division by zero” and return 0.

abs

1

Computes the absolute value of the argument.

quit

0

Prints the function usage statistics, and ends the program.

Parsing the command line

Your program will read the command as a single line. It then splits it into several tokens. The first is the command. Any other tokens after the first are the parameters. To parse a command, simply use the split function on the string. Don’t forget to convert the parameters to floats so that you can perform arithmetic operations.

The code below shows you how to use the split function to extract the command and the parameters.

>>> userinput="add 1 2"
>>> tokens = userinput.split(" ")
>>> print(tokens[0])
add
>>> print(tokens[1])
1
>>> print(tokens[2])
2

Sample Outputs

Welcome to iCalculator.
>add 3 4.0
7.0
>mul 3 5
15.0
>abs 5
5.0
>abs -7
7.0
>abs 8
8.0
>quit
Function usage count
add function : 1
sub function : 0
mul function : 1
div function : 0
abs function : 3

In: Computer Science

Implement a stack in C++ using an array, not an array list. Make your stack size...

Implement a stack in C++ using an array, not an array list.

Make your stack size 5 when you test it, but do not hardcode this! You should be able to change the size for testing purposes with the change of one variable.

DO NOT use Stack class defined in C++

Implement the following methods in your stack class.

  • stack() creates an empty stacks, stack s is new and empty.
  • push(item) adds a new item to the stack s, stacks is modified.
  • pop() removes and returns an item, stack s is modified.
  • isEmpty() returns a boolean and tests for an empty stacks, stack s is not modified.
  • isFull() returns a boolean and tests for an full stacks, stack s is not modified.
  • size() returns the int size of the stacks, stack s is not modified
  • print() prints the stacks from front to rear, stack s is not modified.
  • top() prints the front element, stack s is not modified.

Write your own Driver file to show that you have implemented all the methods of the stack. A psuedocode example is listed below to guide you. Use print statements as well to show the popped elements, to show the stack after some pushes, to print the size of the stack.

  • push(redShirt)
  • push(greenShirt)
  • push(yellowPants)
  • push(purpleSock)
  • push(pinkSocks)
  • printStack()
  • size()
  • push(blueShirt)
  • size()
  • pop()
  • pop()
  • size()
  • pop()
  • printStack()
  • top()
  • pop()
  • pop()
  • printStack()
  • size()
  • isEmpty()
  • printStack()

In: Computer Science

Python - Rewriting a Program Rewrite Program 1 using functions. The required functions are in the...

Python - Rewriting a Program

Rewrite Program 1 using functions. The required functions are in the table below.

Create a Python program that will calculate the user’s net pay based on the tax bracket he/she is in. Your program will prompt the user for their first name, last name, their monthly gross pay, and the number of dependents.

The number of dependents will determine which tax bracket the user ends up in. The tax bracket is as follows:

  • 0 – 1    Dependents:    Tax = 20%
  • 2 – 3    Dependents:    Tax = 15%
  • 4+        Dependents:    Tax = 10%

After calculating the net pay, print the name of the user, the monthly gross pay, the number of dependents, the gross pay, the tax rate, and the net pay.

The formula to compute the net pay is: monthly gross pay – (monthly pay * tax rate)


function

Description

read_name()

Reads the name entered, and returns the name.

read_gross_pay()

Reads the gross pay amount, and returns the amount.

read_dependents()

Reads the number of dependents, and returns the number.

compute_tax_rate(dependents)

Computes and returns the tax rate, based on the number of dependents.

compute_net_pay(gross_pay, rate)

Computes and returns the net pay, based on the gross pay and the tax rate.

main()

Main function of the program.

Sample run:

Enter your name: Ron Swanson
Enter your gross pay: $3500
Enter number of dependents: 0

Name:      Ron Swanson
Gross pay: $3500.00
Dependents: 0
Tax rate: 20%
Net Pay: $2800.00

In: Computer Science

Simplify (A xor B) + (A xor C) using K-maps, does  (A xor B) + (B xor...

Simplify (A xor B) + (A xor C) using K-maps, does  (A xor B) + (B xor C) have the same K-map?

In: Computer Science

•A theater owner agrees to donate a portion of gross ticket sales to a charity •The...

•A theater owner agrees to donate a portion of gross ticket sales to a charity

•The program will prompt the user to input:

−Movie name

−Adult ticket price

−Child ticket price

−Number of adult tickets sold

−Number of child tickets sold

−Percentage of gross amount to be donated

•Inputs: movie name, adult and child ticket price, # adult and child tickets sold, and percentage of the gross to be donated

•The program needs to:

1.Get the movie name

2.Get the price of an adult ticket price

3.Get the price of a child ticket price

4.Get the number of adult tickets sold

5.Get the number of child tickets sold

PLEASE USE C++

In: Computer Science