1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Novay_Z [31]
3 years ago
15

he specific gravity of gold is 19.3. Write a MATLAB program that will ask the user to input the mass of a cube of solid gold in

units of kilograms and display the length of a single side of the cube in units of inches. The output should display a sentence like the following one, with the length formatted to two decimal places.

Computers and Technology
1 answer:
Rama09 [41]3 years ago
4 0

Explanation:

Specific gravity of gold = G = 19.3

We know that the specific gravity of gold is given by

G = ρg/ρw

Where ρg is the density of gold and ρw is density of water which is 1000 kg/m³

Now we can find out the density of gold

ρg = G*ρw

ρg = 19.3*1000

ρg = 19300 kg/m³

We also know that density and mass are related as

density = mass/volume

ρg = m/V

where volume of cube is given by

V = s³

Where s is the length of each side

ρg = m/s³

s³ = m/ρg

s = ∛(m/ρg) meters

To convert from meters to inches multiply by 39.37

s = ∛(m/ρg)*39.37 inches

Finally we get the relation of mass and length of side of a gold cube.

Matlab Code:

density = 19300;

% get input from the user that is mass of gold in kg

mass= input('Please input mass of gold in kg\n');

% check if the user has entered valid mass if it is less than or equal to zero then display error

if (mass<=0)

fprintf('Error: Wrong input! please try again');

else

% If the mass is valid then calculate the length of side of the cube

s = (mass/density);

% nthroot() is used to calculate the cube root

s = nthroot(s,3);

% to convert from meters to inches

s = s*39.37;

% finally display the length with 2 decimal points accuracy

fprintf('The length of side of the gold cube is: %.2f inches\n', s);

end

Output:

Please input mass of gold in kg

-2

Error: Wrong input! please try again

Please input mass of gold in kg

0.4

The length of side of the gold cube is: 1.08 inches

You might be interested in
The phrase ____ refers to an organization of components that define and regulate the collection, storage, management and use of
Burka [1]

Answer:

A. Database Management System

Explanation:

A Database Management System or DBMS is a set of programs that allow the DB administrator to the information extraction, storage and modification out of a database. It also provides tools to add, erase, modify or even analyze the data within the DB. Some examples of DBMS are MySQL, mongo DB, Ms SQL Server, etc.

3 0
3 years ago
4. Give name=
Svet_ta [14]

Answer:

What does Bob [1] return?

What about Bob[-2]?

What about Bob[1:-1]?

How to get the length of Bob?​

Explanation:

8 0
3 years ago
In order, the three-step process of using a file in a C++ program involves
Anna71 [15]

Answer:

c. open the file, read/write/save data, close the file

Explanation:

8 0
3 years ago
The two key elements of any computer system are the ________ and the ________.
mezya [45]
The second the hardware and the software
5 0
3 years ago
Hackers never break laws and while performing their work. <br> True or False.
Darya [45]

FalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalse

5 0
3 years ago
Other questions:
  • What is the drawback of the linear model?
    5·2 answers
  • In CadStd, what does the Zoom All button do? A. Makes a drawing bigger so you can see small details B. Returns a drawing to a si
    5·1 answer
  • To move up one paragraph, press the ____ key(s). f1 alt up arrow up arrow ctrl up arrow
    8·1 answer
  • Tom is the aerobics coordinator at a fitness center. He needs a more efficient way for his instructors to share information. Cla
    13·2 answers
  • Even though a high-level programming language
    11·1 answer
  • Write a program which simulate rolling dice. When the program runs, it will prompt the user to choose a number ranging from 1 to
    15·1 answer
  • Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 38 then the outpu
    11·1 answer
  • An automatic transmission is a mechanism that _
    7·1 answer
  • Windows Rights Management Services is used in conjunction with which Microsoft applications?
    11·1 answer
  • What type of hacker is primarily motivated by an ideology, epitomizing "the ends justify the means" mentality?.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!