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
Alexandra [31]
3 years ago
14

Integer to Float Conversion All labs must be done during lab time. Each labs worth 10 points The lab can be hand in next day wit

h 2 points penalty. Remember: Grading will be on program correctness and comment completeness. (Every line of code should be commented. Also be sure to fill out the template comments.) Write a program that prompt the user for a temperature in Celsius and then display the result in Fahrenheit. Sample Output: Please input a temperature in Celsius => 39 The temperature in Fahrenheit is: => 102.19999695
Engineering
1 answer:
andrew-mc [135]3 years ago
4 0

Answer:

Code explained below

Explanation:

.data

msg1: .asciiz "Please input a temperature in celsius: "

msg2: .asciiz "The temperature in Fahrenheit is: => "

num: .float 0.0

.text

main:

#print the msg1

li $v0, 4

la $a0, msg1

syscall

#read the float value from user

li $v0,6 #read float syscall value is $v0

syscall #read value stored in $f0

#formula for celsius to fahrenheit is

#(temperature(C)* 9/5)+32

#li.s means load immediate float

#copy value 9.0 to $f2

li.s $f2,9.0  

#copy value 5.0 to $f3

li.s $f3,5.0

# following instructions performs: 9/5

#div.s - division of two float numbers

#divide $f2 and f3.Result will stores in $f1

div.s $f1,$f2,$f3

#following instruction performs: temperature(C) * (9/5)

#multiple $f1 and $f0.Result stored in $f1

mul.s $f1,$f1,$f0

#copy value 32 to $f4

li.s $f4,32.0

#following instruction performs: (temperature(C) * (9/5))+32

#add $f1 and $f4.Result stores in $f1

add.s $f1,$f1,$f4

#store float from $f1 to num

s.s $f1,num

#print the msg2

li $v0, 4 #print string syscall value is 4

la $a0, msg2 #copy address of msg2 to $a0

#print the float

syscall

li $v0,2 #print float syscall value is 2

l.s $f12,num #load value in num to $f12

syscall

#terminate the program

li $v0, 10 #terminate the program syscall value is 10

syscall

You might be interested in
100 kg of refrigerant-134a at 200 kPa iscontained in a piston-cylinder device whose volume is 12.322 m3. The piston is now moved
natali 33 [55]

Answer:

(a) Final temperature is 151.2 K

(b) Change in the specific internal energy is -30.798 kJ/kg

Explanation:

(a) P1 = P2 = 200 kPa

V1 = 12.322 m^3

V2 = 1/2 × V1 = 1/2 × 12.322 = 6.161 m^3

mass of refrigerant-134a = 100 kg

MW of refrigerant-134a (C2H2F4) = (12×2) + (2×1) + (19×4) = 24 + 2 +76 = 102 g/mol

number of moles of refrigerant-134a (n) = mass/MW = 100/102 = 0.98 kgmol

R = 8.314 kJ/kgmol.K

Final temperature (T2) = P2V2/nR = 200×6.16/0.98×8.314 = 151.2 K

(b) Change in specific internal energy = change in internal energy (∆U)/mass (m)

∆U = Cv(T2 - T1)

Cv = 20.785 kJ/kgmol.K

T1 = P1V1/nR = 200×12.322/0.98×8.314 = 302.4 K

∆U = 20.785(151.2 - 302.4) = 20.785 × -151.2 = -3142.7 kJ/kgmol × 0.98 kgmol = -3079.8 kJ

Change in specific internal energy = -3079.8 kJ/100 kg = -30.798 kJ/kg

5 0
3 years ago
For the R function shown below(Attachment):
Virty [35]

Answer:

The given function will return an integer in term of j on each iteration of while loop. However, it is noted that this program has some syntax error. The complete code executed in an online R compiler with explanation is given below

Explanation:

def<-function(j){

               k=0;

               i=1;

               while (i<j**3) #j raise to power 3

                   {

               

                   k<-k+1;#k=k+1

                   i <- i*2;#i=i*2

                   print(k);#

               }

 

    }

 def(6)# if you pass the value 6 to function def(j)

5 0
3 years ago
Consider a thermal energy reservoir at 1500 K that can supply heat at a rate of 150,000 kJ/h. Determine the exergy of this suppl
ANEK [815]

Answer:

exergy = 33.39 kW

Explanation:

given data

thermal energy reservoir T2 = 1500 K

heat at a rate = 150,000 kJ/h = \frac{15000}{3600} kW =  41.67 kW

environment temperature T1 = 25°C = 298 K

solution

we get here maximum efficiency that is  reversible efficiency is express as

reversible efficiency = 1 - \frac{T1}{T2}    ...............1

reversible efficiency = 1 - \frac{298}{1500}  

reversible efficiency =  0.80133

and

the exergy of this supplied energy that is

exergy  = efficiency × hat supply   ................2

exergy = 0.80133 × 41.67 kW

exergy = 33.39 kW

5 0
4 years ago
The bulk density of a compacted soil specimen (Gs = 2.70) and its water content are 2060 kg/m^3 and 15.3%, respectively. If the
yaroslaw [1]

Answer:

the saturated density should be

Explanation:

4 0
3 years ago
A force is a push or pull in A.a circle B.an arc C.a straight line
Bingel [31]

Answer:

I think it is B: an arc

Explanation:

hope this helps mark as brainiest

4 0
3 years ago
Other questions:
  • A 500-m^3 rigid tank is filled with saturated liquid-vapor mixture of water at 200 kPa. If 20% of the mass is liquid and the 80%
    11·1 answer
  • In order to test the feasibility of drying a certain foodstuff, drying data were obtained in a tray dryer with air flow over the
    14·1 answer
  • Explain how the objects in a battery work with its components
    10·1 answer
  • Create a program that calculates the monthly payments on a loan using Decimal &amp; LC Console SEE Sanple Run Attached Specifica
    14·1 answer
  • For a steel alloy it has been determined that a carburizing heat treatment of 14 h duration at 809°C will raise the carbon conce
    13·1 answer
  • I will put other link in comments
    12·1 answer
  • What energy type is represented in the picture?
    6·2 answers
  • If my current directory is ‘AR’ write the path for my current directory
    5·1 answer
  • The following is a series of questions pertaining to the NSPE Code of Ethics. Please indicate whether the statement are true or
    14·1 answer
  • Task Three :Write a C++ program to read temperature
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!