CSP2151 Workshop 4 Assignment

Edith Cowan University
School of Science        

CSP2151 Workshop 4

Write a function is_sorted(int A[], int n) that returns “true” if the array A[0..n -1] is in sorted order.

Write a corresponding function :

sqmatrix_mult(sqmatrix A, sqmatrix B, sqmatrix C, int n) that calculates the matrix product C = A × B, assuming that each matrix is n by n.

Write the function strlen(char *s) that returns the length (in characters) of the string indicated by s . If you find it easier to think in terms of arrays, regard the argument as being of type char s[] .

Define a structure to account for this situation:

Cars have six -character registration numbers, and two dates associated with them – the date the car was first registered, and the date that the current registration expires. Each car also has fields (40 -byte string s) for manufacturer, make, body type, and colour; and a field to record the number of owners it has had.

Write a function bigger_planet(solar_system_t s, int p1, int p2) that returns 1 if the p1’th planet in the solar system described by s is heavier than the p2’th one; returns 0 if it is smaller; and returns – 1 if either of the planet indices is invalid.

Design and Implement the following:

Design and implement a program that reads text from the standard input, and writes a list of the distinct words t hat appear. Words may be limited to a maximum of 10 alphabetic characters. Assume that as many as 1,000 distinct words might appear.


Design and extend your previous program to do the following:

You should alter the instructions that appea r at the beginning of each drop so that any mention to information contained in the Planet structure is taken from there rather than hard coded as text (print variables in your printf() function call).

The Lunar Lander program should now have an outer loop. This will allow you to simulate the lunar landing over an over without quitting. At the end of each loop, the program should display a list of the 10 high est scores. This should be stored in an array of High_Score . If a player manages to beat a high score when they land, you should ask for their name and then insert their name, remaining fuel and score into the High_Score chart.

Create a Data Structures called Planet and High_Score.

Planet should con tain: Planet_Name, Fuel, Velocity, Height, Gravity, the Maximum_Thrust of the engines and a D ifficulty rating.

High_Score should contain Name, Fuel and Points.

You will have to decide the data types based on your previous program and judgement. You can calculate the score ( Points ) by multiplying the remaining fuel by the planet’s difficulty factor.

For the time being, your program will continue to use only the moon for landing.

Your program should also incorporate these functions:

float Delta_V(float, int, float*);

int Check_Status(float, float);

int Print_Scores(High_Score_t*);

void Get_High_Score(float, int, High_Score_t*);

If in doubt, remember to view the sample executable given.

CSP2151 Workshop 4 Assignment

+ Submit Your Assignment Here

AssignmentHippo Features

On Time Delivery

Our motto is deliver assignment on Time. Our Expert writers deliver quality assignments to the students.

Plagiarism Free Work

Get reliable and unique assignments by using our 100% plagiarism-free.

24 X 7 Live Help

Get connected 24*7 with our Live Chat support executives to receive instant solutions for your assignment.

Services For All Subjects

Get Help with all the subjects like: Programming, Accounting, Finance, Engineering, Law and Marketing.

Best Price Guarantee

Get premium service at a pocket-friendly rate at AssignmentHippo


Client Review

I was struggling so hard to complete my marketing assignment on brand development when I decided to finally reach to the experts of this portal. They certainly deliver perfect consistency and the desired format. The content prepared by the experts of this platform was simply amazing. I definitely owe my grades to them.

Tap to Chat
Get instant assignment help