ACS130 Introduction to Systems Engineering and Software

Assignment Help C/C++ Programming
Reference no: EM133110853

ACS130 Introduction to Systems Engineering and Software C Programming - The University of Sheffield

Assignment briefing:

This assignment will assess your ability to solve a problem using these C programming elements: repetition (e.g. for.. or while..), selection (if), structures, two dimensional arrays, pointers, I/O and functions. Your task is to write a C program to:

• **Allow the user to input the size of a matrix. The contents of the matrix are read in from a file, which has a list of 100 float numbers (numbers in the file are <100.00). If the matrix is 3x2, then the first 2 numbers in the list form the first row, the second 2 numbers in the list form the second row ...and so on).
• The matrix must have between 1 and 10 columns and between 1 and 10 rows. The matrix size (rows x columns) is determined by the user, and this information is stored in a struct matrix (specified below) in members int nrows and int ncols.
• The contents of the matrix will also be stored in the struct matrix in member
float mValues[10][10].
• Calculate the determinant: Ask the user to choose the row and column to form a 2x2 matrix, which is a subset of the original matrix. The 2x2 matrix contents must be stored in a new struct matrix variable, along with its size. The determinant of this matrix is then calculated. (See sample run of program below).
• Find the inverse of the 2x2 matrix: The inverse matrix contents must be stored in a new struct matrix variable, along with its size. ##
• Loop from ** to ##, but allow the user some way of exiting the loop and stopping the program
The program shall define a structure to hold information about the matrices as follows (only define one structure, but declare 3 structure variables: one for the original matrix, one for the 2x2 sub matrix and one for the inverse):

struct matrix
{
float mValues[10][10]; // to hold the values in the matrix, up to 10 rows x 10 columns
int nrows; // to hold the number of rows used in mValues
int ncols; // to hold the number of columns used in mValues
};

Notes (refer to mark scheme for more details):

1. The array that holds the matrix values has maximum size 10x10, which means that the program must be able to work with any array up to that size. For this program, the minimum array size allowed is 1 x 1.

2. A sample .txt file with 100 numbers is available on ACS130 Blackboard. Please note that you will need to test your code thoroughly to cover every possible scenario (eg to get a det=0). I will be using a different test data to test your program.

3. The program must display to the screen the contents of each matrix in the program, after it has been input or created.

4. The program must allow both square and non-square matrices, e.g. 3 x 3 is square, 3 x 4 is not square.

5. You must program defensively. The program must check for out of range values for rows and columns at every possible instance. The program must ask the user to enter again if incorrect. You also need to check if the input file is available. You also need to take into consideration things like: possibility of generating a 2x2 matrix (because the input matrix is smaller, eg, 2x1), having a 1x1 matrix, and finding the inverse when the determinant is 0 or does not exist.

6. You cannot use global variables. You will get 0 for the whole code. #define can be used.

7. You cannot use while(1) loops. You will get 0 for the whole code. You can use a while(OK) loop where OK is a variable that is, for eg, 0 or 1

8. You cannot use break (unless it is part of a switch case).

9. You cannot use goto, continue, jump.

10. The program must include main( ) and the following 4 functions. The function prototypes must be as follows:

void matrixInput(struct matrix *mat, FILE *in); /* to input the size (number of rows and columns) of the matrix, and read in the values from the file (using fscanf) into the 2D array that makes up the matrix */ NOTE, the file opening and checking occurs in main(), eg FILE
*fin; fin=fopen(" xyz.txt",'r'); then use fin in the function call.

void matrixDisplay(struct matrix mat); /* to display the values in the 2D array that makes up the matrix*/

float matrixDeterminant(struct matrix m1, struct matrix *m2, int
*check); /* to find the determinant of m2, where m2 is a 2x2 subset matrix of m1; returns determinant to main. If determinant is not equal to 0, check =1; if determinant=0, check=2, otherwise check is 0 (when size of matrix <2x2). check variable is needed for the inverse. This function does not display either m1 or m2. */

void matrixInverse(struct matrix m2, float determinant, struct matrix
*m3); /* to find the inverse (if possible) of the 2x2 matrix; this function does not display either m2 or m3. */

11. You are free to add extra functions, for example, for out-of-range checks (for rows and columns), or any other defensive programming required, but you must have the 4 functions listed above.

Attachment:- Systems Engineering and Software.rar

Reference no: EM133110853

Questions Cloud

Company image within community : You have just been given $35k to help build the company's image within the community.
How should georgetown ltd recognise this purchase : Using historical cost as a measurement base, how should Georgetown Ltd recognise this purchase of land in its financial statements
What is the firm cash conversion cycle : A company has an average inventory level of $2,886,000, an average trade receivables level of $1,512,000, and an average trade payables level of $761,000.
Several small business management concepts : During this semester, you were exposed to several small business management concepts
ACS130 Introduction to Systems Engineering and Software : ACS130 Introduction to Systems Engineering and Software C Programming Assignment Help and Solution, The University of Sheffield - Assessment Writing Service
Protection against the decline in the value : How can put options be used to provide you protection against the decline in the value of your holding shares over the next four months?
At what amount should the company''s inventory be reported : The market value of this inventory is currently $19 per unit. At what amount should the company's inventory be reported on the balance sheet
Christie artuso : When we do consider all of the 'good' that has been accomplished through these cells (HeLa cells)
What is the benefit of financial globalization : What is the benefit of financial globalization (discuss the case of the closed and open economy)?

Reviews

len3110853

3/24/2022 10:54:08 PM

Do this C program assignment on Codeblocks. Please read through the ENTIRE briefing and do as it says what to do

Write a Review

C/C++ Programming Questions & Answers

  A list of toppings should be shown on the screen as a menu

Write a menu-driven C++ program that allows a user to select from the following items: Pizza, Cheeseburger, and Hot Dog. Pizza should be represented by the integer value 1. Cheeseburger should be represented by the integer value 2.

  Performs a merge sort on 2 number sequences

Write a C program Sort.c that performs a merge sort on 2 number sequences produced by the program in Q1. Sort.c should spawn 2 processes and each of the children processes would exec() the Gen program to produce a sequence.

  Create a graphical (not text-based) visual c++ program

Create a graphical (not text-based) Visual C++ program that allows the user to enter the coefficients for a system of four equations with four unknowns. Include a button that when clicked, will solve the system of equations and display the results in..

  Write complete implementation of cohen sutherland algorithm

Write a complete implementation of the Cohen Sutherland algorithm, putting together the pieces described. Why will a "divide by zero" never occur? Consider a vertical line segment such that delx is zero

  Write a program that will read in 2 numbers per line

1.Write a program that will read in 2 numbers per line, and print the sum. You program should work for any number of lines of data.

  Write a gui program to sample different fonts

Write a GUI program to sample different fonts. The user enters a line of text in a text field. The user then selects a font from a font menu.

  Definition of two queues

Write a code in C lenguage for the definition of two queues, one to hold the process in ready state and one to hold the process in waiting state. The queue should be designed to manage a process structure. Please comment the code.

  Does you program blow up on unexpected input

COMP 2103X1- Does you program "blow up" on unexpected input, or does it deal with bad input in a "graceful" way? How does your program deal with boundary conditions, if there are any?

  A program to computes the area and volume

Write a program that reads in the radius and length of a cylinder and computes the area and volume using the following formulas.

  Implement a string class

Implement a String class. Each object of this class will represent a character string. Data members are the length of the string and the actual character string. In addition to constructors, destructor, access functions, and a print function, incl..

  Ask the user for a number between 1 and 11 stop asking when

Ask the user for a number between 1 and 11; stop asking when the user enters 0 OR when the total goes over 21. Display the total on the screen.

  Guessing game

In C++ develop a "guessing game" where the computer and the user alternatively guess the value of a randomly selected secret number between 1 and 99 (or any other maximum value). Initially, the computer selects the random number, and the user make..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd