Questions
Develop a program to maintain a Linked List of homework assignments name and due date. When...

Develop a program to maintain a Linked List of homework assignments name and due date. When an assignment is assigned, add it to the list, and when it is completed, remove it. You should keep track of the due date. Your program should provide the following services each contained within its own method:

  • Add a new assignment.
  • Remove an assignment.
  • Provide a list of the assignments in the order they were assigned.
  • Find the assignment(s) with the earliest due date

-The commands are input from the user keyboard as well as the Assignment Names and the Assignment Due Dates. All entered by the user.

-Coded with comments

In: Computer Science

How do I convert a character column into date in R/Sql? The data is in the...

How do I convert a character column into date in R/Sql? The data is in the format "01 02:52:12" i.e <day> <hr>:<min>:<sec>
I want to convert this into Date time format.

In: Computer Science

Write a C/C++ program which reads in a list of process names and integer times from...

Write a C/C++ program which reads in a list of process names and integer times from stdin/cin and simulates round-robin CPU scheduling on the list. The input is a list of lines each consisting of a process name and an integer time, e.g. ProcessA 4 ProcessB 10 Read the list until end of transmission (^d). You should read the list and represent it in a linked list data structure. You should use the alarm system call to schedule a timer interrupt every 3 seconds. The interrupt handler should pick the next process from the process list, write a message saying how much time it has left to execute, i.e. ProcessA 4 Then update its time left to execute by subtracting 3 seconds and return it to the end of the queue. If the process had no time left to execute, you should write a message saying this i.e. ProcessA Finished And delete this process from the linked list. If there are no processes left to execute, write a message saying No processes left And terminate your program.

In: Computer Science

Integer Pointers Program and Analysis Demonstrate an understanding of basic C++ programming concepts by completing the...

Integer Pointers Program and Analysis

Demonstrate an understanding of basic C++ programming concepts by completing the following:

  • Program: Create a C++ program that asks the user to enter three integer values as input. Store the values into three different variables. For each variable, create three integer pointers that point to each value. Display the contents of the variables and pointers. In your program, be sure to use the new operator and delete operators to management memory.
  • Program Analysis: Given your program implementation, discuss and identify the possible security vulnerabilities that may exist. If present, discuss solutions to minimize the vulnerabilities. Discuss and identify possible problems that can result in errors when using integer pointers. Your analysis should be 1-2 pages in length.

In: Computer Science

Rewrite the attached code program using read, write, open and close (System I/O functions) instead of...

Rewrite the attached code program using read, write, open and close (System I/O functions) instead of the standard I/O functions. Also please write comments explaining each line of code clearly and concisely please.

#include
#include

int main(int argc, char *argv[])
{ FILE *fd;
   char c;

   if(argc==1)
   fd=stdin;
   else
        if((fd = fopen(argv[1], "r"))==NULL){
       fprintf(stderr, "Error opening %s, exiting\n", argv[1]);            exit(0);
   }

   while( (c=getc(fd)) != EOF)
   putc(c, stdout);

   exit(0);
}

In: Computer Science

this is my code in python I am trying to open a file and then print...

this is my code in python I am trying to open a file and then print the contents on my console but when i run it nothing prints in the console

def file_to_dictionary(rosterFile):

myDictionary={}

  

with open(rosterFile,'r') as f:

for line in f:

myDictionary.append(line.strip())

print(myDictionary)

  

  

  

  

return myDictionary

  

file_to_dictionary((f"../data/Roster.txt"))

  

  

In: Computer Science

Use a JavaScript program to: Stimulate a coin tossing environment using random functions and using a...

Use a JavaScript program to:

Stimulate a coin tossing environment using random functions and using a for loop - toss the coin 100 times and print the number of heads and tails.

A detailed answer would be appreciated, I would like to learn from it rather than just know the answer. Thanks in advance!

In: Computer Science

Change the format of the given code to two columns, add a sub title and an...

Change the format of the given code to two columns, add a sub title and an author name and increase the color and thickness of the column-rule. Add an image and float the text around the image.

<!DOCTYPE html>
<!-- Fig. 5.17: multicolumns.html -->
<!-- Multicolumn text in CSS3. -->
<html>
<head>
<meta charset = "utf-8"›
<title>Multicolumns</title>
<style type = "text/css"›
p
{ margin:0.9em Oem; }
.multicolumns
{
/* setting the number of columns to 3 */
-webkit-column-count: 3;
-moz-column-count: 3;
-o-column-count: 3;
column-count: 3;
/ *setting the space between columns to 30px */
-webkit-column-gap: 30px;
-moz-column-gap: 30px;
-o-column-gap: 30px;
column-gap: 30px;
/ *adding a 1px black line between each column */
-webkit-column-rule: 1px outset black;
-moz-column-rule: 1px outset black;
-o-column-rule: 1px outset black;
column-rule: 1px outset black;
}
</style>
</head>
<body>
<header>
<h1>Computers, Hardware and Software<h1/>
</header>
<div class = "multicolumns">
<p>A computer is a device that can perform computations and make logical decisions phenomenally faster than human beings can. Many of today's personal computers can perform billions of calculations in one second&mdash;more than a human can perform in a lifetime. Supercomputers are already performing thousands of trillions (quadrillions) of instructions per second! To put
that in perspective, a quadrillion-instruction-per-second computer can perform in one second more than 100,000 calculations for every person on the planet! And&mdash;these "upper limits" are growing quickly!</p>
<p>Computers process data under the control of sets of instructions called computer programs. These programs guide
the computer through orderly sets of actions specified by people called computer programmers. The programs that run on a computer are referred to as software. In this book, you'll learn today's key programming methodology that's enhancing programmer productivity, thereby reducing software-development costs&mdash;object-oriented programming.</p>
<p>A computer consists of various devices referred to as hardware (e.g., the keyboard, screen, mouse, hard disks, memory, DVDs and processing units). Computing costs are dropping
dramatically, owing to rapid developments in hardware and software technologies. Computers that might have filled large rooms and cost millions of dollars decades ago are now inscribed on silicon chips smaller than a fingernail, costing perhaps a few dollars each. Ironically, silicon is one of the most abundant materials&mdash;it's an ingredient in common sand. Silicon-chip technology has made computing so economical that more than a billion general-purpose computers are in use
that more than a billion general-purpose computers are in use worldwide, and this is expected to double in the next few years.</p>
<p>Computer chips (microprocessors) control countless devices. These embedded systems include anti-lock brakes in cars, navigation systems, smart home appliances, home security systems, cell phones and smartphones, robots, intelligent traffic intersections, collision avoidance systems, video game controllers and more. The vast majority of the microprocessors produced each year are embedded in devices other than general-purpose computers.</p>
<footer>
<em>&copy; 2012 by Pearson Education, Inc.
All Rights Reserved.</em>
</footer>
</div>
</body>
</html>

In: Computer Science

Objectives To reinforce the use of If-Else statements To learn how to use while loops Introduction:...

Objectives

  1. To reinforce the use of If-Else statements
  2. To learn how to use while loops

Introduction: Mission to Mars

Your friend has been playing a new Mars Colony simulator nonstop! They are always talking about how cool it would be if they could be a on the first real-life mission to Mars! To amuse your friend, you have decided to create a series of programs about the possible first colony on Mars.

Problem: Where Can We Get the Best Deal? (marssupplier.c)

Now that we know how much fuel we need and how much equipment we can take, we need to determine which supplier will give us the best deal on what we need to purchase. We will poll a number of suppliers to see what kind of pricing they can give us and select the supplier who has the best deal.

In this program, we want to ask the user for information about suppliers. We can assume that there will be at least one supplier, but we will not know ahead of time how many suppliers there might be. After each supplier’s information, ask the user if there is another supplier to consider.

For each supplier, ask the user for the deal that the supplier is willing to offer. Keep track of the best possible deal and which supplier (identified as a number: 1, 2, 3, etc.) is offering it. After all the suppliers have been considered, tell the user which supplier offered the best deal.

Input Specification

  1. The user will use ‘Y’ to indicate there is at least one more supplier to consider.
  2. The user will use ‘N’ to indicate that there are no more suppliers to consider.
  3. Each suppliers’ price will be a positive real number.

Output Specification

For each supplier, prompt the user with:

What is the price for supplier #X?

To ask about additional suppliers, prompt the user with:

Is there another supplier to consider?

For the final print out, tell the user which supplier they should select, including the best price rounded to two decimal places:

Supplier #X had the best price at $Y.YY.

Output Samples

Below are some sample outputs of running the program. Note that these samples are NOT a comprehensive test. You should test your program with different data than is shown here based on the specifications given above. In the sample run below, for clarity and ease of reading, the user input is given in italics while the program output is in bold. (Note: When you actually run your program no bold or italics should appear at all. These are simply used in this description for clarity’s sake.)

Sample Run 1

What is the price for supplier #1?

500.49

Is there another supplier to consider?

N

Supplier #1 had the best price at $500.49.

Sample Run 2

What is the price for supplier #1?

250.39

Is there another supplier to consider?

Y

What is the price for supplier #2?

500.49

Is there another supplier to consider?

Y

What is the price for supplier #3?

178.72

Is there another supplier to consider?

Y

What is the price for supplier #4?

300.00

Is there another supplier to consider?

N

Supplier #3 had the best price at $178.72.

In: Computer Science

C++ programming test 2, chapters 6,7,& 9 on Functions, Arrays, & Pointers 1. Create a one...

C++ programming test 2, chapters 6,7,& 9 on Functions, Arrays, & Pointers

1. Create a one dimensional array, Ages, which will hold 4 ages. Each age is an int.

       b. Write a for loop and print, in reverse order the 4 values stored in memory assuming that the ages in the previous question have already been entered with a space between each value. Use subscript notation.

           

                        short cnt;

c. Do the same as above, but use pointer notation.

2. Create, but do not initialize with data, one array for each of the following situations. Use an appropriate data type and name for each array:

            a. holding the height of 10 students - 1 dimension - use most efficient storage size

     

            b. holding payments per year arranged like this table to be printed in a book

(Year and 1,2,3,4,5 are NOT part of the array. Neither are 6.5%, 6.75%, 7.0%)

                                    Year

                        1          2          3          4          5         

           

            6.5%     123.23    104.32    99.23     80.75     67.45   

                       

            6.75%    131.24    111.54   103.23    90.55     78.95

           

            7.0%      141.54    120.54   107.43    98.67     88.98

            There will be 75 tables like this for different amounts in the book.

            Create the array to hold these 75 tables.

3. Using the array name and proper subscripts, print the 120.54 from the above array considering it is the 62nd table in the array of tables.

           

4. Convert to pointer notation using the same variable:

                        data[9]

                        ddata[2][5]  

5. Use cout to print the address at which the following array is stored in the computer memory.

            short    YourData[12];

            a. Print the address of the first element of the array

            b. Print the address of the fifth element of the array

6. a. Given the following array and variables, print it so that all the items from 1 column are printed before any items on the second column, etc. Use for loop constructs, NOT while loop. Use subscript notation.

            float TestData[10][20];

            int row, col;

b. Dos the same as above using pointer notation.

7. Given the following, write the code to have C++ calculate:

            long Arr [100];

            a. Using the array name, Arr, calculate NUMBER OF BYTES IN ONE ELEMENT:

b. Calculate the NUMBER OF BYTES IN ONE ELEMENT using the data type

            (problematic for future code maintenance).

              c. Calculate the total number of bytes in the entire array.

              d. Calculate the number of elements in the array.

Anything relating to reference variables or arrays will be so described. Assume any others are by value

8. Write the header line for the following functions - each function is named F1

  1. A function returning a long and receiving as data parameters a short, an array of float and an array of double.

b. A function returning a reference to an int and receiving a 2 dimensional array of double with 23 columns.

c. Returning an int and receiving 3 int reference variables.

9. Write the following functions in full, including header line and body. Call each F1.

a. Receives 4 arguments, two arrays of short and two int's, one for each array, containing the count of array elements in that array. The function computes one grand total for both arrays. It then returns the grand total.

b. Receives an array of long. Returns the 2nd value stored in the array.

c. Write a function to receive a 2 dimensional array of long double with 10 columns. Also you will receive a short value representing the number of rows. The function totals all of the amounts in the array. The total of the values is returned as a long double.

d. . This function, F1, receives a pointer to an int array and a pointer to a double as arguments. It then calls the function called F2, which has the following prototype:

            void F2( int *arr, double num );

F1 is going to call F2 and send the array and the double value as arguments, receiving nothing back.

Write the entire function F1 which calls F2 as its only operation.

e. Change this function to reference variables:

float * fun1( float *a, int *b, float d)

{

                        *a = *b * d;

            return a;

}

Rewrite the entire function below:

In: Computer Science

An amateur meteorologist wants to keep track of weather conditions during the past year's three -month...

An amateur meteorologist wants to keep track of weather conditions during the past year's three -month summer season and has designated each day as either rainy ('R'), cloudy ('C'), or sunny ('S'). Write a modu lar program that stores this information in a 3 x 30 array of characters, where the row indicates the month (0 = June, 1 = July, 2 = August) and the column indicates the day of the month. Note that data is not being collected for the 31st of any month . The program should begin by calling a function to read the weather data in from a file. Then it should create a report that displays for each month and for the whole three-month period, how many days were rainy, how many were cloudy, and how many were sunny. To help it do this, it should use a value -returning function that is passed the array, the number of the month to examine, and the character to look for ('R', 'C', or 'S') . This function shou ld return the number of days the indicated month had the requested weather. Data for the program can be found in the Rai nOrShi ne. da t file located in the Chapter 8 programs folder on this book's companion website. please do this program in c++ and please add comments.

In: Computer Science

Consider the recursive formulation of the Binary Search algorithm. Given a sorted and non-decreasing list of...

Consider the recursive formulation of the Binary Search algorithm. Given a sorted and non-decreasing list of comparable objects L, and a new item x, find the location (index) of x or indicated that x is not in L.

5a) Give a recursive algorithm for binary search. No, while, for, repeat etc statements are allowed. Only if, if else and assignment statements are allowed.

5b) Write a difference equation for the running time of your Binary Search algorithm. Solve your equation and express the performance of the algorithm in Θ(·) notation.

In: Computer Science

A prime number is a number that is only evenly divisible by itself and 1. For...

A prime number is a number that is only evenly divisible by itself and 1. For example, the number 5 is prime because it can only be evenly divided by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6.


Design a Boolean function called isPrime, that accepts an integer as an argument and returns True if the argument is a prime number, or False otherwise. Use the function in a program that prompts the user to enter a number and then displays a message indicating whether the number is prime. The following modules should be written:


getNumber, that accepts a Ref to an integer, prompts the user to enter a number, and accepts that input


isPrime, that accepts an integer as an argument and returns True if the argument is a prime number, or False otherwise


showPrime, that accepts an integer as an argument , calls isPrime, and displays a message indicating whether the number is prime


The main module, that will call getNumber and showPrime


In: Computer Science

During 1 30 minute observation, a web server received 2700 requests. The mean response time was...

During 1 30 minute observation, a web server received 2700 requests. The mean response time was 2 seconds. What is the mean number of queries in the system? Give both formula and result. Does your formula depend upon distributional assumptions?

In: Computer Science

Consider the problem of sorting an array A[1, ..., n] of integers. We presented an O(n...

Consider the problem of sorting an array A[1, ..., n] of integers. We presented an O(n log n)-time algorithm in class and, also, proved a lower bound of Ω(n log n) for any comparison-based algorithm.
1. Give an efficient sorting algorithm for a boolean1 array B[1, ..., n].

2. Give an efficient sorting algorithm for an array C[1,...,n] whose elements are taken from the set
{1,2,3,4,5}.

3. Give an efficient sorting algorithm for an array D[1, ..., n] whose elements are distinct (D[i] ̸= D[j],
for every i ̸= j ∈ {1, ..., n}) and are taken from the set {1, 2, ..., 2n}.

4. In case you designed linear-time sorting algorithms for the previous subparts, does it mean that
the lower bound for sorting of Ω(n log n) is wrong? Explain.

In a boolean array B[1, ..., n], each element B[i] (for i = 1, ..., n) is either 0 or 1.

In: Computer Science