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]
2 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]2 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
Given the lists list1 and list2, not necessarily of the same length, create a new list consisting of alternating elements of lis
tester [92]

Answer:

The following code is written in Python Programming Language.

Program:

list1=[1,2,3]

 # initialized the list type variable

list2=[4,5,6,7,8]

  # initialized the list type variable

list3=[]

   # initialized the empty list type variable

for j in range(max(len(list1), len(list2))):   #set for loop

 if j<len(list1):

  #set if statement

   list3.append(list1[j])

  #value of list1 appends in list3  

 if j<len(list2):

   #set if statement

   list3.append(list2[j])

  #value of list2 append in list3

print(list3)    #print the list of list3

Output:

[1, 4, 2, 5, 3, 6, 7, 8]

Explanation:

Here, we define three list type variables "list1", "list2", "list3" and we assign value in only first two variables "list1" to [1, 2, 3] and "list2" to [4, 5, 6, 7, 8] and third list is empty.

Then, we set the for loop and pass the condition inside it we pass two if conditions, in first one we compare the list1 from variable "j" inside it the value in list1 will append in list3, and in second one we compare "j" with list two and follow the same process.

After all, we print the list of the variable "list3".

5 0
3 years ago
Central processing unit definition computer
Feliz [49]

The CPU reads machine instructions from program memory and executes them.

4 0
3 years ago
Read 2 more answers
What is the importance of data validation, and how can user data entry errors be reduced or eliminated?
lisabon 2012 [21]

Incorrect data can lead to unexpected program execution results. Data entry errors can be reduced by only accepting valid input, e.g., if a number must be entered, alphabetic characters are ignored. After data validation, error messages can be prompted to the user, requiring him to enter the data again.

5 0
3 years ago
A virus that propagates using the internet or another computer network is called __________.
olasank [31]
This is called a worm
8 0
3 years ago
61:39 A communication sent through Transmission Control Protocol (TCP) arrives out of order. What allows the data to be put back
kobusy [5.1K]

Answer:

Sequence Numbers

Explanation:

In the transmission control protocol, the sequence number are used to put data back in order.

It is the number pattern that follows sequence. This is the number pattern which interprets data before they are returned by the recipient as an acknowledgement with its numbers.

When a sent data is out of order, the sequence number works towards correcting the sequence before sending its acknowledgement.

7 0
3 years ago
Other questions:
  • When a typist changes from a conventional typewriter to a word processor, his typing schema will have to _____ to incorporate th
    12·1 answer
  • Some financial institutions can be really bad about putting unexpected charges
    12·1 answer
  • A(n) Answer display color uses the least electricity when compared to any other color.
    15·1 answer
  • Write a class named Accumulator containing: An instance variable named sum of type integer. A constructor that accepts an intege
    14·1 answer
  • The World Wide Web is full of unstructured data. Search engines like Google, Bing and Yahoo have been doing a good job of allowi
    5·1 answer
  • Write a SELECT statement that uses an aggregate window function to get the total amount of each order. Return these columns: The
    13·1 answer
  • The two major types of system software programs are utility programs and the ________. Select one: A. user interface B. supervis
    13·1 answer
  • me pueden ayudar con mi trabajo sii porfss si me dan la respuesta correcta y les doy la mejor coronita si​
    12·1 answer
  • what impact of information communication technology have on the environment about electronic waste, use of electricity?​
    9·1 answer
  • Write a method reverse that takes an array as an argument and returns a new array with the elements in reversed order. Do not mo
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!