Answer:
c = float(input("Enter the temperature in Celsius: "))
f = c * 1.8 + 32
print("The temperature in Fahrenheit: " + str(f))
k = (f - 32) / 1.8 + 273.15
print("The temperature in Kelvin: " + str(k))
Explanation:
*The code is in Python.
Ask the user to enter the temperature in Celsius
Convert the Celsius to Fahrenheit using the conversion formula and print it
Convert the Fahrenheit to Kelvin using the conversion formula and print it
Answer:
See explaination
Explanation:
//Array to store prices
INT PRICE[10][10]
//Loop through 2d array
FOR I FROM 0 TO 10
FOR J FROM 0 TO 10
//Populate a random int
PRICE[I][J] = RANDOM_INT(99,1999)
PRINT(PRICE[I][J]+" ")
PRINT()
//Prompt user for desired price
COST = READ_INPUT('Please enter your desired flight price: ')
//Variable to store if a match is found
MATCH = FALSE
//Loop through all ints in price
FOR I FROM 0 TO 10
FOR J FROM 0 TO 10
//Compare price with Cost
IF PRICE[I][J]==COST
MATCH = TRUE
BREAK
//Check if match is true
IF MATCH = TRUE
PRINT('A flight was found for that price, have a safe trip!')
ELSE
PRINT('No flight was found for that price, please try a new price.')
Answer:
2. <em>A reference of type A can be treated as a reference of type B</em> - False
Base class or its objects are not related to their derived class (or its objects).
Explanation:
class A {
int a;
public A() {
a = 7;
}
}
class B extends A {
int b;
public B() {
b = 8;
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
1. <em>After the constructor for class B executes, the variable a will have the value 7 </em>- True.
When an object of a derived class is declared, the constructor of base class is called before the constructor of derived class (is called).
3. <em>Both variables a and b are instance variables </em>- True.
Classes can have instance, or member, variables and methods.
4.<em> After the constructor for class B executes, the variable b will have the value 8</em> - True.
When object of class B is declared, its constructor was called, which initialized variable b to 8.
That is an interactive question.
Answer:
- var projected_fee = 6000;
-
- for(var i = 1; i <= 5; i++){
- projected_fee = projected_fee * 0.02 + projected_fee;
- console.log("$" + projected_fee.toFixed(2));
- }
Explanation:
Firstly, create a variable, projected_fee, and set the initial tuition fee value to it (Line 1).
Next, user a for loop that run for 5 times to repeatedly calculate the projected_fee based on 2 percent of increment rate (Line 4) and display the projected fee to console terminal (Line 5). The output should be
$6120.00
$6242.40
$6367.25
$6494.59
$6624.48