A half-life is the amount of time it takes for a substance or entity to fall to half its original value. Caffeine has a half-life of about 6 hours in humans. Given caffeine amount (in mg) as input, output the caffeine level after 6, 12, and 24 hours. Use a string formatting expression with conversion specifiers to output the caffeine amount as floating-point numbers. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}'. format(your_value)) Ex: If the input is: 100 the output is: After 6 hours: 50. 00 mg After 12 hours: 25.00 mg After 24 hours: 6.25 mg Note: A cup of coffee has about 100 mg. A soda has about 40 mg. An "energy" drink (a misnomer) has between 100 mg and 200 mg. 312198.2042412.qx3zgy7 LAB 9.14.1: LAB: Input and formatted output: Caffeine levels 0/10 ACTIVITY main.py Load default template... 1 caffeine_mg = float(input())
Q: Calories = ( (Age x 0.2757) + (Weight x 0.03295) + (Heart Rate x 1.0781) — 75.4991 ) x Time / 8.368…
A: The steps of the program are: Take input for the variables age, weight, heart_rate, time using the…
Q: Evaluate the following expressions. (2) a. 4 * 7 == 74 / 3 b. 4 + 7 / 2 = 8 - 6.2 * 1.5
A: Note - As per the guidelines, we are only allowed to answer 1 question and 3 sub parts.
Q: A half-life is the amount of time it takes for a substance or entity to fall to half its original…
A: We need to use the format as mentioned using the print statement to achieve desired output.
Q: Q6: Draw a flowchart to find the sum m of real numbers (X1, X2, X3, .Xm). So that the result is the…
A: Solution:
Q: Madison County collects property taxes on the assessed value of property, which is 60 percent of its…
A: Madison County collects property taxes on the assessed value of property, which is 60 percent of its…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats)…
A:
Q: Q3) Write a program that converts the weather from Celsius to Fahrenheit in a specific day. The…
A: Program Code: #include <iostream> #include <cstring>using namespace std; int main(){…
Q: a. Read the day as a string input and the weather in Celsius as integer input. b. Convert the…
A: Since there is no programming language is mentioned, i have used c++ for solution
Q: In Python: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon…
A: Define the method cost(). This method takes three parameters- number of miles, miles par gallon and…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats)…
A: The given problem is related to programming language where the user will input the miles/gallon and…
Q: The following equation estimates the average calories burned for a person when exercising, which is…
A: Algorithm: Start Read Age,Weight, HeartRate, Time Calculate Calories = ((Age x 0.2757) + (Weight x…
Q: A half-life is the amount of time it takes for a substance or entity to fall to half its original…
A: A Half-Life Is The Amount Of Time It Takes For A Substance Or Entity To Fall To Half Its Original…
Q: Write a program which accepts days as integer variable and display total number of years, months and…
A: Please find the answer below :
Q: Suppose that x, y, and z are int variables and x = 13, y = 45, and z = 20. Determine whether the…
A: a. !(x - y <= 10) Decoding the above line is as follows, ==> !(13-45<=10) ==> !(-32…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats)…
A: formula used to calculate gas cost driven_miles/miles_per_gallon*dollars_per_gallon
Q: QJ Write a program to calculate the amount of three equations according to the amount of z. Where,…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.…
Q: The following equation estimates the average calories burned for a person when exercising, which is…
A: Start Input age Input weight Input Heart Rate Input time Calculate the calories Print number of…
Q: Declare double variables num1, den1, num2, and den2, and read each variable from input in that…
A: Double type variables:- A variable of type double is a 64-bit floating data type.The double data…
Q: N1, N2 and Nn print the largest number of them for example
A: a flowchart to read N numbers: N1, N2 and Nn print the largest number of them for example
Q: 04 write a program that accepts a day, month and year then calculate the day of year corresponding…
A: I will explain this question in details,
Q: Extend to cast the double to an integer, and output that integer. Enter integer: 99 Enter double:…
A: Program import java.util.Scanner;public class BasicInput { public static void main(String[] args)…
Q: In a triangle, the sum of the 1st and 2nd side must always be greater than the 3rd side. Create a…
A: logic:- read three sides. Check if it is valid or not by using if first>0 && second>0…
Q: You are required to write a program to compute the area of square (area = side) OR a triangle (area…
A: Required:
Q: ). The force of gravity is different for each planet of the nine planets in our solar system. For…
A: #include<iostream>#include<bits/stdc++.h> #include<string>using namespace std;…
Q: Q7 Draw the flowchart and write a C program using else if to calculate the total amount to be paid…
A: The program prompts the user to enter basic loan amount and number of years. Basic loan amount is…
Q: Write a program to enter any number of the year and month, and then determine whether the year is a…
A: Required: Required code with comments for explanation and screenshot of both code and output has…
Q: Write a program which accepts days as integer variable and display total number of years, months and…
A: EXPLANATION: - The integer variables for reading the input as the total number of days and…
Q: Q5: A/ Use input funetion to write a computer programming to test the weather state according to a…
A: Matlab pprovides us with if else statements better known as conditional statements to check weather…
Q: Suppose you are a surveyor. Your job requires you to study some maps that give distances in…
A: Program Plan: Create function kiloToMiles1() to convert kilometer in miles by using pass by value.…
Q: An integer is taken input from user and you have to find whether the integer is Palindrome or not.…
A: Task :- Write a C++ code to identify if entered integer is palindrome or not. C++ program :-…
Q: Suppose that height is a double variable, ch is a char variable, and name is a string variable. What…
A:
Q: A half-life is the amount of time it takes for a substance or entity to fall to half its original…
A: Given requirement, A half-life is the amount of time it takes for a substance or entity to fall to…
Q: date June 10, 1960 is special because when we write it in the following format, the month times the…
A: #include <iostream> int main() { int d; int m; int y; std::cin >> d;…
Q: Write a program which accepts days as integer variable and display total number of years, months and…
A: import java.util.*;public class Main{ public static void main(String[] args) { int…
Q: The following equation estimates the average calories burned for a person when exercising, which is…
A: Accept below value from user: Enter age in year. Enter weight in pounds. Enter heart eate in beats…
Q: A half-life is the amount of time it takes for a substance or entity to fall to half its original…
A: Input the weight at start Calculate weights for every 6 hours Display weights at requested intervals
Q: Given an airplane’s acceleration a and take-off speed v, you can compute the minimum runway length…
A:
Q: Write a program that converts temperature from Fahrenheit to Celsius and vice versa.
A: Dear Student below is the Java code provided for Fahrenheit to Celsius and vice versa conversion.
Q: The following formula gives the area of a triangle and volume of a triangular prism. Area = s(s –…
A: The cost of the carpet per square meter is = area * 1010.85
Q: 5. The user will input a Philippine amount, then the said amount will be converted to different…
A: Note: As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: Suppose that str1, str2, and str3 are string variables, and str1 = "Low", str2 = "High", and str3 =…
A: Evaluation of the given expressions: Consider that str1, str2, and str3 are string variables and…
Q: Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both…
A: #program to find cost for 20,75,500 miles for given miles/galon and gas dollars/gallon#reading…
Q: Q1: You will be given two positive integers, a and b (a 9 and it is an even number then print…
A: After taking input from the user I have compared the value of the input to be positive and a less…
Q: Write a program that can determine the number of days in a month for a specified month and year. The…
A:
Q: Take 5 numbers from the user. Sum the first 4 numbers and subtract the last number from sum. Then,…
A:
Q: Your program must keep on prompting the user if an incorrect time was given; see below for examples.…
A: C program used to answer this question
Q: The goal of this program is to input one number consisting of five digits (in one word) from the…
A: import java.util.Scanner; class Digit { // 2. two private members private String digit;…
Q: (Converting a given date to the day number in the year) Write a program that prints the day number…
A: Algorithm: Start Store the number of days of a normal year in a list named regYear and number of…
Q: Print two f-string statements to display the following according to the rules below: 1) Food…
A: #declare all the given fieldsfood1 = 'Salad'food2 = 'Sandwich'price1=3.6price2=4.99 #print the food…
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
- 13.16.1: Overload salutation printing. Complete the second PrintSalutation function to print the following given personName "Holly" and customSalutation "Welcome":Welcome, Holly End with a newline. #include <iostream>#include <string>using namespace std; void PrintSalutation(string personName) { cout << "Hello, " << personName << endl;} // Define void PrintSalutation(string personName, string customSalutation)... /* Your solution goes here */ int main() { PrintSalutation("Holly", "Welcome"); PrintSalutation("Sanjiv"); return 0;}5.21 In Python: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is: 1712 the output is: 1712 is a leap year. Ex: If the input is: 1913 the output is: 1913 is not a leap year. Your program must define and call the following function. The function should return true if the input year is a leap year and false otherwise.def is_leap_year(user_year)4.19 C++ Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done then the output is: ereht olleH yeH
- C++ 10.19 Given a line of text as input, output the number of characters excluding spaces, periods, exclamation points, or commas. Ex: If the input is: Listen, Mr. Jones, calm down. the output is: 21 Note: Account for all characters that aren't spaces, periods, exclamation points, or commas (Ex: "r", "2", "?"). code provided: #include <iostream>#include <string>using namespace std; int main() { string userText; // Add more variables as needed getline(cin, userText); // Gets entire line, including spaces. /* Type your code here. */ return 0;}5.23 In Python: Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function. The function exact_change() should return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies.def exact_change(user_total)21.7 LAB: Login name (Use python) Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first five letters of the last name, followed by the first letter of the first name, and then the last two digits of the number (use the % operator). If the last name has less than five letters, then use all letters of the last name. Ex: If the input is: Michael Jordan 1991 the output is: Your login name: JordaM91 Ex: If the input is: Kanye West 2024 the output is: Your login name: WestK24
- 11.4.1: Leap year - functions. A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. If the input is 1712, the output is: 1712 is a leap year. If the input is 1913, the output is: 1913 is not a leap year. Your program must define and call a function: Function OutputLeapYear(integer inputYear) returns nothing The function should output whether the input year is a leap year or not. Need program written in the coral language10.25 LAB: Quadratic formula Implement the quadratic_formula() function. The function takes 3 arguments, a, b, and c, and computes the two results of the quadratic formula: x1=−b+b2−4ac2a x2=−b−b2−4ac2a The quadratic_formula() function returns the tuple (x1, x2). Ex: When a = 1, b = -5, and c = 6, quadratic_formula() returns (3, 2). Code provided in main.py reads a single input line containing values for a, b, and c, separated by spaces. Each input is converted to a float and passed to the quadratic_formula() function. Ex: If the input is: 2 -3 -77 the output is: Solutions to 2x^2 + -3x + -77 = 0 x1 = 7 x2 = -5.507.24 LAB: Convert to binary-functions Write a program that takes in a positive integer as input, and outputs a string of 1's and O's representing the integer in binary. For an integer x, the algorithm is As long as x is greater than 0 Output x 2 (remainder is either 0 or 1) x = x // 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string Ex: If the input is the output is: 110 The program must define and call the following two functions. Define a function named int to reverse_binary() that takes an integer as a parameter and returns a string of 1's and O's representing the integer in binary (in reverse). Define a function named string reverse() that takes an input string as a parameter and returns a string representing the input string in reverse. def int_to_reverse_binary(integer_value) def string reverse(input_string) LAB ACTIVITY 7.24.1: LAB. Convert to binary-functions 0/10 1 # Define your functions here. 2…
- 5.28 LAB: Convert to binary - functions Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string. Ex: If the input is: 6 the output is: 110 Your program must define and call the following two functions. The IntegerToReverseBinary() function should return a string of 1's and 0's representing the integer in binary (in reverse). The ReverseString() function should return a string representing the input string in reverse. string IntegerToReverseBinary(int integerValue)string ReverseString(string userString)C++ 13.9.2 Pass by reference Define a function ScaleGrade() that takes two parameters: points: an integer, passed by value, for the student's score. grade: a char, passed by reference, for the student's letter grade. ScaleGrade() changes grade to A if the points are greater than or equal to 88 and less than or equal to 100, and grade is not A. Otherwise, grade is not changed. The function returns true if grade has changed, and returns false otherwise. Ex: If the input is 88 B, then the output is: Grade is A after curving. Using the following code #include <iostream>using namespace std; // insert code here int main() { int studentPoints; char studentGrade; bool isChanged; cin >> studentPoints; cin >> studentGrade; isChanged = ScaleGrade(studentPoints, studentGrade); if (isChanged) { cout << "Grade is " << studentGrade << " after curving." << endl; } else { cout << "Grade " << studentGrade…1(a): Implement the following C function : concatenate the lowest byte of each of two integers. The output should have 0's in the two most significant bytes , followed by the least significant byte of the first then second argument . For example , concatLowBytes (0x12345678 , 0xaabbccdd) 0x000078dd . You may use hexidecimal constants of any size. You should not use binary notation , function calls , loops or conditional statements. Examples : concatLowBytes ( 0x00000011 , 0x00000022)=0x00001122 concatLowBytes (0x12345678 , 0xaabbccdd )= 0x000078dd int concatLowBytes (int x, int y){ }