SCHEME :-)
(define (convert temp x y)
(cond ((and (real? temp)
(or (equal? "C" x) (equal? "F" x) (equal? "K"
x))
(or (equal? "C" y) (equal? "F" y) (equal? "K"
y)))
(cond
((and (equal? "C" x) (equal? "F" y)) (+ (* temp
1.8) 32))
((and (equal? "C" x) (equal? "K" y)) (+ temp
273.15))
((and (equal? "F" x) (equal? "C" y)) (/ (- temp
32) 1.8))
((and (equal? "F" x) (equal? "K" y)) (+ (/ (-
temp 32) 1.8) 273.15))
((and (equal? "K" x) (equal? "C" y)) (- temp
273.15))
((and (equal? "K" x) (equal? "F" y)) (+ (* (-
temp 273.15) 1.8) 32))
))
(else "Could not convert from
apples to oranges")
)
)
SCHEME :-) [5 marks] Write a procedure called convert that takes as arguments: a temperature value...
SCHEME [3 marks] Define a procedure called days_in_month that takes as arguments two numbers representing a month and a year. The procedure should return the number of days in the given month. Note: the procedure should account for leap years. You may assume valid month and year values are passed in as arguments. E.g. (days_in_month 9 2019) → 30 E.g. (days_in_month 2 2019) → 28 E.g. (days_in_month 2 2020) → 29
FOR PYTHON Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom functionc_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a...
Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning...
i need a python code For an exact conversion between "Fahrenheit temperature scale" and "Celsius temperature scale", the following formulas can be applied. Here, F is the value in Fahrenheit and the value in Celsius: Temperature Conversions C = 5 9 (F - 32) F = (š xc) + 3 Write a Python program that uses the above formula to convert Celsius to Fahrenheit and vice versa. We ask user to input "Enter a degree: ", and then we get...
In java Se8 i am trying to write a program convert temperature between celsius, fahrenheit and kelvin, but i am stuck at how to return the proper result without chage the frame, and I cnould not figure out how to use those three settemp method. import java. uti1. Arrays public class Temperature different scale names/ public static Stringll scales -Celsius", "Fahrenheit", "Kelvin private double temperature private char scale; public Temperature (double temp temp 273. 15; this. scale-C if (temp <-273....
Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C - A consecutive group of memory chunks. D - None of the choices. Question 2 How many times is the body of the loop executed? int i=1; while(true) { cout << i; if(++i==5) break; } A - Forever B - 4 C - 5 D - 6 E - 0 Question 3 What is wrong with the following piece of...
In Problem Set 7 you designed and implemented a Message class. This time, let's design and implement a Mailbox class in a file named Mailbox java. Do the following with this class • You may use the Message class from PS 7. You will have to add new features to the Message class from PS 7 as you work through this problem. You are welcome to start with my sample solution if you wish • Suppose there are multiple mail...