Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please include screenshot of the code thankyou and in C not C++ check picture for ta better look at the question A point mass consists

please include screenshot of the code thankyou and in C not C++ check picture for ta better look at the question
A point mass consists of a s- location and an associated mass, such as
Location:(6,0, -2) Mass: 3g
In a system of point masses, let pi, Pz,...p, be the n 3-D points and mi, mz,. ..mn
be their associated masses. If m is the sum of the masses, the center of gravity
C is calculated as
(mpi + mpz +... +m.p.)
Write a program that repeatedly inputs point-mass system data sets from an
input file until an input operation fails. For each data set, display the location
matrix, the ma
ass vector, n, and the center of gravity.
Each data set includes a location matrix (a matrix in which each row is a
point), a one-dimensional array of masses, and the number of point masses, n.
Allow n to vary from 3 to 10.
Sample Data File
2521
3216
4338
454
This sample should be stored as:
location
3216
4338
5 44
25214
mass
Your main function should repeatedly input and process data sets from an
input file until end of file is encountered. For each point-mass system data
set, display the location matrix, the mass vector, n, and the center of gravity.
Implement at least the following functions:
fget _point_mass: Takes an open input file and a maximum value for n as
parameters and fills a two-dimensional array output parameter with a
location matrix and a one-dimensional array output parameter with a mass
vector from the data file. Returns as function value the actual value of n.
center_grav: Takes a location matrix, mass vector, and n value as param-
eters, and calculates and returns as the function value the center of gravity
of the system.
fwrite point_mass: Takes an open output file and the location matrix, mass
vector, and n value of a point-mass system as parameters and writes the
system to the file with meaningful labels.
image text in transcribed
image text in transcribed
A point mass consists of a 3-D location and an associated mass, such as Location: (6,0, -2) Mass: 3g In a system of point masses, let P1, P2, ...pa be the n 3-D points and m, m2,...M be their associated masses. If m is the sum of the masses, the center of gravity C is calculated as 1 C=mpi + map2 + ... + mnpm) m Write a program that repeatedly inputs point-mass system data sets from an input file until an input operation fails. For each data set, display the location matrix, the mass vector, n, and the center of gravity. Each data set includes a location matrix (a matrix in which each row is a point), a one-dimensional array of masses, and the number of point masses, n. Allow n to vary from 3 to 10. Sample Data File 4 5 4 -4 -9 -4 3 -3 8 3 -2 - 1 6 NUN 2 5 2 1 This sample should be stored as: location 5 -4 4 -4 co w w 3 -2 -1 6 -3 8 mass -9 2 5 2 1 4 n Your main function should repeatedly input and process data sets from an input file until end of file is encountered. For each point-mass system data set, display the location matrix, the mass vector, n, and the center of gravity. Implement at least the following functions: fget_point_mass: Takes an open input file and a maximum value for n as parameters and fills a two-dimensional array output parameter with a location matrix and a one-dimensional array output parameter with a mass vector from the data file. Returns as function value the actual value of n. center_grav: Takes a location matrix, mass vector, and n value as param- eters, and calculates and returns as the function value the center of gravity of the system. fwrite_point_mass: Takes an open output file and the location matrix, mass vector, and n value of a point-mass system as parameters and writes the system to the file with meaningful labels

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions

Question

1. Discuss the four components of language.

Answered: 1 week ago

Question

a. How many different groups were represented?

Answered: 1 week ago