Questions
In this task you will implement a C++ function with arguments: a sorted integer array, size...

In this task you will implement a C++ function with arguments: a sorted integer array, size of the array, and a target integer value. Find all combinations of two elements in the sorted array which sum up to the target value. When found, add the combinations into an array, and print it. Where there is greater than one combination, you may use the number 200 as a separator for the combinations in the output array.

Do not use more than one loop. Use pointer notation of arrays to do this question.

In: Computer Science

Using C++ (microsoft visual studios 2013) create a program that uses three parallel numberic arrays of...

Using C++ (microsoft visual studios 2013) create a program that uses three parallel numberic arrays of size 6. The program searches one of the arrays and then displays the corresponding values from the other two arrays. The program should prompt the user to enter ProductID. Valid ProductID's should be the numbers 24, 37, 42, 51, 66 and 79. The program should search the array for the product ID in the ID's array and display the corresponding price and quantity from the prices and quantities array. Populate the prices and quantities arrays with any values you desire. Price should allow for two decimal places. Allow the user to display the price and quantitiy for as many product ID's as desired without having to execute the program again. Of course and bad ProductID's should display an error message, but the user should be able to continue until a sentinel is entered. The program should be structured to work with any numbers should to company change product ID's in the future.

In: Computer Science

Directions: You are to write a C++ program that meets the instruction requirements below. Deliverables: ·Your...

Directions: You are to write a C++ program that meets the instruction requirements below.

Deliverables:

·Your C++ source code file. (The file with the .CPP extension).No other files will be accepted.

  • A screenshot of your program running.

Program Instructions:

Consider the following incomplete C++ program:

#include <iostream>

int main()

{

}

1.    Write a statement that includes the header files fstream, string, and iomanip in this program.

2.    Write statements that declare inFile to be an ifstream variable and outFile to be an ofstream variable.

3.    The program will read data from the file inData.txt and write output to the file outData.txt. Write statements to open both of these files, associate inFile with inData.txt, and associate outFile with outData.txt.

4.    Suppose that the file inData.txt contains the following data:

Giselle Robinson Accounting

5600 5 30

450 9

75 1.5

The first line contains a person’s first name, last name, and the department the person works in. In the second line, the first number represents the monthly gross salary, the bonus (as a percent), and the taxes (as a percent). The third line contains the distance traveled and the traveling time. The fourth line contains the number of coffee cups sold and the cost of each coffee cup. Write statements so that after the program executes, the contents of the file outData.txt are as shown below. If necessary, declare additional variables. Your statements should be general enough so that if the content of the input file changes and the program is run again (without editing and recompiling), it outputs the appropriate results.

Name: Giselle Robinson, Department: Accounting

Monthly Gross Salary: $5600.00, Monthly Bonus: 5.00%, Taxes: 30.00%

Paycheck: $4116.00

Distance Traveled: 450.00 miles, Traveling Time: 9.00 hours

Average Speed: 50.00 miles per hour

Number of Coffee Cups Sold: 75, Cost: $1.50 per cup

Sales Amount = $112.50

5.    Write statements that close the input and output files.

6.    Write a C++ program that tests the statements in parts a through e.

In: Computer Science

Appendix A A retail business wishes to automate some of its sales procedures. The retailer buys...

Appendix A A retail business wishes to automate some of its sales procedures. The retailer buys items in bulk from various manufacturers and re-sells them to the public at a profit. Preliminary interviews reveal that there are number of staff roles in the Sales department. A salesperson can place orders on behalf of customers and check the status of these orders. A technical salesperson has the same duties, but additionally is able to provide customers with detailed technical advice (which we would not expect an ordinary salesperson to be able to do). A sales supervisor is a salesperson, with the additional responsibility of creating new customer accounts and checking their credit-worthiness. A dispatcher is responsible for collecting the goods ordered from the warehouse and packing them for dispatch to the customer. To assist in this operation, the computer system should be able to produce a list of unpacked orders as well as delete the orders from the list that the dispatcher has packed. All staff are able to find general details of the products stocked, including stock levels and locations in the warehouse. A re-ordering clerk is responsible for finding out which products are out of stock in the warehouse, and placing orders for these products from the manufacturers. If these products are required to satisfy an outstanding order, they are considered to be "priority" products, and are ordered first. The system should be able to advise the re-order clerk of which products are "priority” products. A stock clerk is responsible for placing items that arrive from manufacturers in their correct places in the warehouse. To do this the clerk needs to be able to find the correct warehouse location for each product from the computer system. Currently, the same person in the business plays the roles of stock clerks and re-order clerk.

Question 1 Total [20]
1.1 Develop a first-cut design class diagram for the use case for place order object (10)
1.2 Develop a CRC cards for place order object with input classes identified (10)
Question 2 Total [57]
2.1 Create a communication diagram for the use case place order (15)
2.2 Develop a multilayer sequence diagram for the use case place order object which includes
view layer and data layer, incorporate the use of alt and loop frame (22)
2.3 Finally, show an updated DCD (10)
2.4 Design the package diagram

In: Computer Science

Python: Write the function pixelLuminance that takes 3 integers r, g, and b, each between 0...

Python: Write the function pixelLuminance that takes 3 integers r, g, and b, each between 0 and 255 (inclusive), representing the red, green, and blue intensity of a pixel and returns the luminance of this pixel as an integer. The function expects each parameter r, g, and b to be an integer in the interval [0,255]. You should use assertions to enforce this constraint.

In: Computer Science

Write some python programs which demonstrate the following concepts: Input data of all the variable types...

Write some python programs which demonstrate the following concepts:

  • Input data of all the variable types we've covered so far (https://realpython.com/python-variables/)
  • Test input of strings with various quoting styles as previously discussed
  • Output all the variables you read.
  • Format output of all variables to create columnar output.
  • Format output of numbers to 2 decimal places
  • Output using both the string formatting and the 'f' formatted string literals notation.

TURN IN

Submit your source code and execution of your code.

In: Computer Science

6. Convert numbers as requested. SHOW YOUR WORK Convert 2B7 (base 16) to binary. Convert 0B2C...

6. Convert numbers as requested. SHOW YOUR WORK

Convert 2B7 (base 16) to binary.

Convert 0B2C (base 16) to binary.

Convert -47 (base 10) to binary 8-bit signed-magnitude.

Convert -52 (base 10) to binary 8-bit signed-magnitude.

Convert -47 (base 10) to binary 8-bit one's complement.

Convert -52 (base 10) to binary 8-bit one's complement.

Convert -39 (base 10) to 8-bit binary using excess 127 notation.

Convert -61 (base 10) to 8-bit binary using excess 127 notation.

In: Computer Science

Python : Write the function inAWhile that takes two integers t and d, where t is...

Python : Write the function inAWhile that takes two integers t and d, where t is the present time on a 12-hour clock, rounded to an integer (so t is an integer in the interval [1,12]) and d is an integer increment in hours, and returns the time on a 12-hour clock in d hours. For example, in 2 hours from 3 o’clock, it will be 5 o’clock, so inAWhile (3, 2) = 5. Notice that 12 is followed by 1 on a 12-hour clock, since only computer scientists start counting at 0. The test data will clarify. Additionally, you should guarantee that the type of the parameters is int, using an assertion. For example, inAWhile (‘Hi’, ‘there’) should fail the assertion, and inAWhile (5, ‘there’) should also fail the assertion.

In: Computer Science

Write a grading program for a class with the following grading policies: There are three quizzes,...

Write a grading program for a class with the following grading policies:

  1. There are three quizzes, each graded on the basis of 10 points.

  2. There is one miterm exm, graded on the basis of 100 points.

  3. There is one finl exm, graded on the basis of 100 points.

The fnal exm counts for 40% of the grade. The miterm counts for 35% of the grade. The three quizzes together count for a total of 25% of the grade. (Do not forget to convert the quiz scores to percentages before they are averaged in.)

Any grade of 90 or more is an A, any grade of 80 or more (but less than 90) is a B, any grade of 70 or more (but less than 80) is a C, any grade of 60 or more (but less than 70) is a D, and any grade below 60 is an F. The program should read in the student’s scores and output the student’s record, which consists of three quiz scores and two exm scores, as well as the student’s overall numeric score for the entire course and final letter grade.

Define and use a class for the student record. The class should have instance variables for the quizzes, midterm, final, overall numeric score for the course, and final letter grade. The overall numeric score is a number in the range 0 to 100, which represents the weighted average of the student’s work. The class should have methods to compute the overall numeric grade and the final letter grade. These last methods should be void methods that set the appropriate instance variables. Your class should have a reasonable set of accessor and mutator methods, an equals method, and a toString method, whether or not your program uses them. You may add other methods if you wish.

JAVA!

In: Computer Science

Minimum value and its position Create a program that: Receive as input in command line the...

Minimum value and its position

Create a program that:

  • Receive as input in command line the sizes m and n of a two dimensional array, and minValue and maxValue between which the random numbers will be generated
  • Generate a array with numbers between minValue and maxValue (inclusive) with the given size (mxn)
  • Compute the minimum value in the array and one of the rows and columns on which it appears.
  • Print the array as a table.
  • Print the minimum value and one of the positions on which it appears.

Run the program 5 times with representative sizes

In: Computer Science

We will make some changes to our first program. If you recall we began with, A...

We will make some changes to our first program. If you recall we began with, A car's gas mileage or miles-per-gallon (MPG) can be calculated with the following Formula: MPG = Miles Driven / Gallons of gas used. Write a class called Mileage. The Mileage class should have two private member variables called miles and gallons of type double. The class should have four public methods: setMiles and setGallons should use void return types; getMiles and getGallons should use double return types. It should have one more method called getMPG that performs the math calculation and returns the double MPG Write a program called MPGMain that asks the user for the number of miles driven and the gallons of gas used. It should call the Mileage class to calculate the car's MPG. The class should return the MPG to the MPGMain where it was called and display the value on the screen. (Format the display and limit the miles-per-gallon to 2 decimal places) in JAVA programming language

In: Computer Science

One of the very practical uses of assembly language programming is its ability to optimize the...

One of the very practical uses of assembly language programming is its ability to optimize the speed and size of computer programs. While programmers do not typically write large-scale applications in assembly language, it is not uncommon to solve a performance bottle neck by replacing code written in a high level language with an assembly language procedure.

In this programming project you will be given a C++ program that generates an array of pseudorandom integers and sorts the array using the selection sort algorithm.

Your job is to write an assembly language procedure that also sorts the array of pseudorandom integers using the selection sort algorithm. The C++ program will time multiple repetitions of the sort performed by both the C++ code and your assembly language procedure. The C++ program will compare the result. If all goes as expected, your assembly language procedure should be faster than the C++ code.

Chapter 13 of your textbook contains a discussion of how to interface an assembly language procedure with a high-level programming language like C++.

The Visual Studio solution for the C++ program that you are given has been packaged and compressed into a file called “ProjectFour.zip”. Create a location on your computer for this project. Download the compressed file, “ProjectFour.zip”, and unpack it into that location in your computer.

Look in the unpacked folder for a file named “ProjectFour.sln”. The “.sln” file extension stands for solution. Double clicking on this file will start up the Visual Studio solution for ProjectFour and allow you to execute the C++ program.

Modify ProjectFour by following these steps:

  1. Click on the project name, “ProjectFour” in the Solution Explorer pane.
  2. Click on the “Project” choice in the menu bar at the top of the screen.
  3. Select “Build Customizations”.
  4. In the Visual C++ Build Customization Files dialog box, check the checkbox next to masm(.targets,.props). Choose OK to save your selection and close the dialog box.
  5. On the menu bar, choose “Project”, then choose “Add Existing Item”.
  6. In the Add New Item dialog box, select the file named “AsmSelectionSort.asm”. Choose Add to add the file to your project and close the dialog box.

Use Ctrl+F5 or click on “Debug” in the Menu Bar followed by “Start Without Debugging” to execute the program. The MASM assembler will assemble AsmSelectionSort.asm into an object file that is then linked into your project.

A “stub” assembly language procedure has been provided so that you can execute the C++ program to get a feel for how it works. Your job is to improve on the efficiency of the C++ compiled code by writing an assembly language procedure that is faster. Click on the file named “AsmSelectionSort.asm” in the Solution Explorer pane. This file is your starting point for creating an assembly language version of the selection sort routine.

As always, start small. DO NOT be the Cookie Monster and gobble up the whole project at once. Steps you might consider, but are not limited to are:

  • Have your assembly language procedure return the number of elements in the array. This will tell you if what is being passed as an argument is the value you expected.
  • Have your assembly language procedure return the value of the first element in the array. This will tell you if you understand how to address and retrieve the value of an element in the array.
  • Have your procedure return the value of the second (or fifth) element in the array. This will tell you if you understand how to address and retrieve the value of a particular element in the array.

This project will provide you with the opportunity to:

  • Link an assembly language procedure to an existing C++ program.
  • Create an assembly language version of a C++ program.
  • Demonstrate your ability to work with a one-dimensional array.
  • Show that you can implement a while loop in assembly language.
  • Demonstrate your ability to implement nested loops in assembly language.
  • Display your understanding of what an assembly language procedure is and how they can be used.
  • Provides a chance for you to show that you understand how to compare values and take conditional action based on the results.
  • Observe how assembly language procedures can be used to optimize programs written in a high-level language like C++.

In: Computer Science

Q4: Suppose you want to send a 5000 character message, using 7-bit ASCII encoding. How many...

Q4: Suppose you want to send a 5000 character message, using 7-bit ASCII encoding. How many TOTAL bits would need to be transmitted using an asynchronous connection? How many of those bits are overhead? How many TOTAL bits would need to be transmitted using a synchronous connection? How many of those bits are overhead? For the synchronous connection, each frame can hold 1000 characters, and has a start byte flag, a stop byte flag, a control byte, a 2 byte address field, and a 2 byte checksum. You may show your work for partial credit

In: Computer Science

Twin elements Create a program that: Input: Receive as input in command line the sizes m...

Twin elements

Create a program that:

  • Input:
  • Receive as input in command line the sizes m and n of a two dimensional array
  • Receive as input in command line the minValue and maxValue between which the random numbers will be generated for your two dimensional array
  • Generate:
  • Generate a two-dimensional with numbers between minValue and maxValue (inclusive) with the given size (mxn)
  • Compute:
  • Compute the number of elements that have a neighbour (up, down, left or right) with the same value.
  • Print:
  • Print the array as a table with the computed sums per rows and columns.
  • Print the computed numbers of twins.

Run the program 5 times with representative sizes

In: Computer Science

Write a MIPS Assembly program that computes the sum of all the odd numbers from 1...

Write a MIPS Assembly program that computes the sum of all the odd numbers from 1 ..99 and print out the answer.

In: Computer Science