Assignment Questions

(Solved): 2) Calculate the rate (distance/time) at which the Pacific p...

2) Calculate the rate (distance/time) at which the Pacific plate...

 

 

Image transcription text

2) Calculate the rate (distance/time) at which the Pacific plate is sliding across the hot spot. a. First determine the slope of the line. If you don't know how to do this see page 4. Plate rate = km/Ma b. The answer above is in units of km/Ma. Geologists typically measure plate motions in units of cm/year. Convert the value above to cm/yr. See page 4. Plate ratc = cm/yr In what direction is the Pacific plate moving?

View full question >>

(Solved): Use C to write a program that: The source process reads inf...

Use C to write a program that:

The source process reads information from a file (Therefore, you need to prepare a small text file for testing purpose).

The source process calls fork() to create the filter process.

The filter process reads information from the source process (passed via an anonymous pipe), converts the uppercase characters to lowercase ones and vice versa, and then prints out the converted characters to the screen.

How to create an anonymous pipe: pipe() API.

**** I attempted the problem, and it is shown in the picture, but it outputs: Segmentation fault (core dumped). I dont know whats wrong****

Show transcribed image text #include #include #include #include #include #include #include #include int main (void) char str[1000]; //buffer int ap[2]; //file descriptor FILE *fp; fpopen("text.txt", "r)I/open file int x read (fp, str, 1000); fclose(fp); //close file pid t pipe; I/fork if ((pipe-fork))) /Ichild close (ap[1]) //close writing on first pipe char str[1000]: read (ap[0], str, 1000); I/read string on first pipe intx strlen (str); //convert upper to lower and vice versa for (int í = 0; i

View full question >>
computer_science

Order This Answer

(Solved): Using a programming language of your choice, write, test, an...

Using a programming language of your choice, write, test, and debug a program that includes the following features:

1. An implementation of bubblesort with the following method signature: void bubblesort(int[] arr)

2. An implementation of a sorting algorithm of your choice with the following method signature: void [algorithmname](int[] arr)

3. An implementation of bubblesort with the following method signature: void bubblesort(String[] arr)

4. An implementation of a sorting algorithm of your choice with the following method signature: void [algorithmname](String[] arr)

5. An implementation of a linear search with the following method signature (the method should return -1 if the item is not found): int linearSearch(int[] arr, int valueToFind)

6. An implementation of a binary search with the following method signature (the method should return -1 if the item is not found): int binarySearch(int[] arr, int valueToFind)

7. An implementation of a linear search with the following method signature (the method should return -1 if the item is not found): int linearSearch(String[] arr, String valueToFind ) 8. An implementation of a binary search with the following method signature (the method should return -1 if the item is not found): int binarySearch(String [] arr, String valueToFind) 9. An implementation of a Hashtable class with the following methods: void add(string key, string value) string remove(string key) /* returns the removed value or NULL if it did not exist in the table */ bool contains(string key) int getCount() /* the number of items in the table */

10. A main method that demonstrates each algorithm and its results.

You may define auxiliary methods or variables as needed.

View full question >>
computer_science

Order This Answer

(Solved): Create the foundation of a menu and ticket system for a rest...

Objective:

Create the foundation of a menu and ticket system for a restaurant point of sale (POS) system using Object Oriented Programming practices. In this project we will create Constructors,

Setters, Getters, and toString methods.

Grade Table:

Task Points

Documentation report 20

Jar file is executable and guidelines are followed 20

Driver class is created as described below 20

Menultem class is created as described below 20

Menu class is created as described below 20

Ticket class is created as described below 25

TOTAL (Points Possible) 125

Instructions:

In this project we are creating part of a restaurant point of sale (POS) system. In future projects we will add additional functionality. For this project you will need to create the following four class files with the listed attributes and methods:

Menultem

String name

Double price

String description

Int orderCode

Each of the above attributes needs appropriate setters and getters

The class needs a toString method

Menu

String restaurantName

o ArrayList of Menultems

o A method to add items the above ArrayList of Menultems

o Setters and getters for the restaurantName

o A toString method that prints the name of the restaurant followed by all of the items in theMenu

Ticket

Int tableNumber

ArrayList of Menultems

A method to add items to the above ArrayList of Menultems

Setters and getters for tableNumber

A getTotal method that returns the total of the items in the ArrayList of Menultems(this is a calculated field)

A toString method that prints

tableNumber

All of the items in theTicket

o The total of the items in ArrayList of Menultems

Driver - A file to test the above classes, the driver should contain the main method and needs to perform the following:

Instantiate 10 Menultems objects with the proper attributes.

Instantiate 1 menu object.

Add the above 10 Menultems to the menu

o Print the menu to the screen

Instantiate 2 ticket objects

Add 3 different Menultems to each of the ticket objects

Print both tickets to the screen

View full question >>
computer_science

Order This Answer

(Solved): the voltage values. Briefly comment on how the acquired sens...

the voltage values. Briefly comment on how the acquired sensor signals change with the physical phenomena 3) You may use the following program template for data acquisition: clc: clear all close all: d dag.getDevices s = daq.createsession ('n?.)? s. burationInseconds Run for 3 seconds Sampling rate 2000 scans/sec s.Rate 2000 Note: You may need to changel the Devicel TD myDA01 to the one assigned in your appilicatioH. The Device ID is stored in % the variable d = dag.getDevices datastartForeground (s): time 1/2000+ (0:length (data)-1); plot (time, data); xlabel ('time (second)'): ylabel ('senson data (vel) )

View full question >>
computer_science

Order This Answer

(Solved): A transaction record on a sales commission file contains the...

A transaction record on a sales commission file contains the retail price of an item sold, atransaction code which indicates the sales commission category to which an item can belong,and the employee number of the person who sold the item.the transaction code can contain the values,bor which indicate that the percentage commission will be 6%,8% or 10%respectively.construct an algorithm that willreada record on the file,calculatethe commissionowing for that record andprintthe retail price, commission and employee number.

Desk check of he uig e of an saction record on a sales commission file contains the retail Drice item sold, a transaction code that indicates the sales commission cate which an item can belong, and the employee number of the person who sol 1. A tran item. The transaction code can contain the values A, B or C, which indicate the percentage commission will be 6%, 8% or 10% respectively. Constru algorithm that will read a record on the file, calculate the commission ow that record, and print the retail price, commission and employee numberr ct owing for an (8 Marks

View full question >>
computer_science

Order This Answer

(Solved): Write, debug, and test a group of classes in an object-orien...

Write, debug, and test a group of classes in an object-oriented language of your choice that implement the following object hierarchy. Include another class called TestObjectHierarchy that contains a main method and demonstrates the functionality of all of the classes.

Here are some helpful geometry reminders: Perimeter of an ellipse: https://www.mathsisfun.com/geometry/ellipse-perimeter.html Area of an ellipse: https://www.math.hmc.edu/funfacts/ffiles/10006.3.shtml Circumference of a circle: 2 * ? * r Area of a circle: ? * r2 Perimeter of a rectangle: 2 * (w + h) Area of a rectangle: w * h interface Shape double getPerimeter() double getArea() class Ellipse implements Shape double getMajorRadius() void setMajorRadius(double r) double getMinorRadius() void setMinorRadius(double r) class Circle extends Ellipse double getRadius() // A Circle is an Ellipse whose major and minor radii are congruent; this rule can be enforced by overriding the appropriate methods in the base class void setRadius(double r) double getCircumference() // this is the same as the perimeter calculated in the base class class Rectangle implements Shape double getWidth() void setWidth(double w) double getHeight() void setHeight(double b) class Square extends Rectangle double getSideLength() // a Square is a Rectangle whose height and width are congruent; this rule can be enforced by overriding the appropriate methods in the base class void setSideLength(double s)

Your Own Object Hierarchy Now that you have had some practice, design and implement your own object hierarchy. Just like the first part of the assignment, this should be a hierarchy that might be useful in the real world. Include the following: At least one abstract base class At least one interface At least two concrete classes (at least one of these should inherit from the abstract base class you created, and at least one should implement the interface you created) At least one overridden method At least one delegated method A test program to show off your hierarchy’s functionality Include a description of the hierarchy in the test program’s header comment as well as descriptions of all the classes in their respective header comments.

View full question >>
computer_science

Order This Answer

(Solved): Restaurant: Make for Restaurant should store two attributes...

TRY IT YOURSELF 9-1. Restaurant: Make for Restaurant should store two attributes: a restaurant_name and a cuisine type Make a method called describe_restaurant() that prints these two pieces of a class called Restaurant. The init () method information, and a method called open restaurant () that prints a message indi- cating that the restaurant is open. Make an instance called restaurant from your class. Print the two attri- butes individually, and then call both methods. 9-2. Three Restaurants: Start with your class from Exercise 9.1. Create three different instances from the class, and call describe restaurant () for each instance. 9-3. Users: Make a class called user. Create two attributes called first name and last_name, and then create several other attributes that are typically stored in a user profile. Make a method called describe user) that prints a summary of the user's information. Make another method called greet user() that prints a personalized greeting to the user. methods Create several instances representing different users, and call both for each user

View full question >>
computer_science

Order This Answer

(Solved): write program in C/C++ and explain the steps for every logic...

Please write program in C/C++ and explain the steps for every logic of program because i am not understanding and getting confused.

Write a program to print all permutations of a given string

Below are the permutations of string ABC.
ABC ACB BAC BCA CBA CAB

View full question >>
computer_science

Order This Answer

(Solved): A Caesar cipher (http://en.wikipedia.org/wiki/Caesar_cipher)...

Description

A Caesar cipher (http://en.wikipedia.org/wiki/Caesar_cipher) is a simple cryptographic technique in which each letter is the original message is shifted to a different letter which is located at a uniform offset in alphabetical order. For example, the message “Hello World!” and offset 3 would result in an encrypted message “Khoor Zruog!” The message “Dogs and Cats” and offset -2 (which is equivalent to an offset of 24) would result in an encrypted message “Bmeq ylb Ayrq”. Note that only alphabetic characters are shifted, and that the case of the letter is preserved.

Functional requirements

Write a Unix program that takes 3 inputs from the command line: the pathname of an existing input file, the pathname of an output file to be created, and an offset between -25 and 25, inclusive. If the input file doesn’t exist, or if the output file cannot be created (perhaps because directories in its path do not exist, or because you don’t have permission to create files in the given location), or if the offset is out of range, the program prints an error message to standard error and immediately ends. Otherwise it uses the input file and offset to create an encoded output file using the Caesar cipher as described above.

Nonfunctional requirements

Implement a function,  char caesar(char s, int n) which converts a letter according to the rule given above with offset n. To avoid strange arithmetic errors use n%26 for the offset. They new char is returned. If the character is not a letter s is returned, unchanged. Use this function to process the entire file.

All the functions you write (including caesar) should be in a file caesar.c, with corresponding .h file. Main should be in its own .c file.

You may use the functions from string.h. To convert the 3rd command line argument from a string to an int, use the strtol or atoi functions from stdlib.h http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/
http://www.cplusplus.com/reference/cstdlib/strtol/

View full question >>
computer_science

Order This Answer