Read in a time such as 3 pm and print the equivalent military hour (such as 15). Validate the input. If the input doesn’t start with an integer, print: Error: Not an integer. If the number isn’t between 1 and 12, print: Error: The hour must be between 1 and 12. If the suffix isn’t "am" or "pm", print: Error: The suffix must be am or pm.
Q: Write a program that reads a four-digit integer, such as 2014, and then displays it, one digit per…
A: Program Approach: Create an empty list. Declare a user input integer variable for taking the…
Q: The annual rate of inflation is the rate at which money loses its value. For example, if the annual…
A: PROGRAM CODE: #include <iostream>#include <iomanip>using namespace std; int main(){…
Q: You have just started a sales job in a department store. Your pay consists of a base salary and a…
A: Program for the given sales problem is given below: we are using java as the language and using…
Q: Mother is the most loved person. She wants to surprise his son on his birthday so she prepares a…
A: Process: Input for the value which decide the total iteration After that run the value loop…
Q: You have just started a sales job in a department store. Your pay consists of a base salary and a…
A: Program for the given problem is define below , in this i use th java as a language and java.awt for…
Q: Write a program that reads a floating point number and prints "zero" if the number is zero.…
A: """Program will read a floating-point number and print "zero"if the number is zero.Otherwise, print…
Q: 10) Write a program that translates a letter grade into a number grade. Letter grades are A, B, C,…
A: note:- always mention programming language name in question, this is done in python. logic:-…
Q: Take a string as a input from the user with all small letters. Then print the next alphabet in…
A: Each character has a corresponding ASCII value in a language character set. Therefore, using…
Q: Write a program that determines a student grade's given his/her final score. Use the following table…
A: According to the Question below the Solution: Output:
Q: Q1/ Write a program that reads from the user the number of students in the class and their grades in…
A: Note: As no language is mentioned, therefore answering in python Input : Number of students Grade…
Q: Take a string as a input from the user with all small letters. Then print the next alphabet in…
A: In the python program, create a variable to store the obtained input from the user; so, the input is…
Q: > Example: Rewrite the previous code by using nested if condition. grade (x) := if x 2 60 out "you…
A: Here we are taking marks as an input and as a output we get grade of a student if student is less…
Q: Write a program that generates and prints 50 random integers, each between 3 and 6. Write a program…
A: 1)Code: as you have not mentioned the coding language i am giving the code in java class Main {…
Q: On a piano, a key has a frequency, say f0. Each higher key (black or white) has a frequency of f0 *…
A: Python code: f=int(input("Enter frequency: "))r=pow(2,1/12) for i in range(4): fn=f*pow(r,i+1)…
Q: Write a program that determines a student's grade. The program will read three types of scores…
A: The program is written in C++ Language. Check the program screenshot for the correct indentation.…
Q: Given the value of n from the user, write a program that will display the first n even numbers. Ex.…
A: Programming approach:- Using the necessary header file. Using namespace standard input/output.…
Q: A word is called as a good word if all the letters of the word are distinct. That is, all the…
A: Actually, python is a easiest programming language. It has a concise(less) code.
Q: 5) Write a program to determine the number of thousands, hundreds, tens, and ones in a given integer…
A: #include <stdio.h> int main() { int n=8532; // declare and initialize the digit int…
Q: Write a program which given an initial three digit number such as. three_digit_number = 123 prints…
A: Program In c # include <stdio.h># include <conio.h>#include<math.h>int main( ){int…
Q: You'll write a poem in this program. However, there are two types of poems you'll have to print out:…
A: Actually, Java is a programming language originally developed by James Gosling at Sun Microsystems…
Q: Write a number activity and then circle the circle or square. The input will be in the form (letter…
A: Algorithm - Create a new function with name perimeter with two arguemnt. Now use the below logic…
Q: Write a program that asks the user to enter any date in the format specified above…
A: The currents scenario here is to write the c++ program that ask the user to enter any date in the…
Q: The Significance (S-value) of an integer number is the number of the digits that are composing the…
A: PROGRAM EXPLANATION: - The program comprise of multiple parts. The input is taken from user for the…
Q: Prompt the user for a string that contains two strings separated by a comma. Examples of strings…
A: import java.util.Arrays;import java.util.List;import java.util.Scanner;import…
Q: read in student marks (double) from the user, determines the highest mark, then ranks students based…
A: Solution :
Q: Write a program that reads non-negative integer number and determines whether it is odd or even or…
A: Here we will write a program that reads non-negative integer number and determines whether it is odd…
Q: Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D,…
A: Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D,…
Q: value) Suppose you save $100 each month into a savings account with an annual interest rate of 5%.…
A: Given: value) Suppose you save $100 each month into a savings account with an annual interest rate…
Q: Q4 write a program that accepts a day, month and year then calculate the day of year corresponding…
A: Given requirement, Write a program that accepts a day, month and year then calculate the day of the…
Q: Find out the final values of a,b and c where following expressions are executed sequentially:[4] int…
A: Here in this question we have given a code fragment.and we have asked to find the final value of a…
Q: Write a program that will figure out the required change for a purchase. Start by asking the user…
A: Introduction of the Program: The Java Program takes the cost of the product and amount paid from the…
Q: Write a program for determining if a year is a leap year. In the Gregorian calendar system you can…
A: Answer :
Q: Write a method named presentValue that performs this calculation. The method should accept the…
A: We know that the amount we get for a principal P after t years is P + PTR/100 So, according to the…
Q: floor(x) function can round the numbers to * the nearest integer O towards infinity O towards minus…
A: the nearest integer
Q: Write a program for determining if a year is a leap year. In the Gregorian calendar system you can…
A: Since programming language is not mentioned, I have done this using Python 3.
Q: Q1/ Write a program that reads from the user the number of students in the class and their grades i…
A: Code:Specific language is not mentioned so i am giving the code in c++ langauge: #include…
Q: Write a program that translates a letter grade into a number grade. Letter grades are A, B, C, D,…
A: Please find the answer below :
Q: Write a program that accepts an integer number and determines whether the number is "EVEN" or "ODD.…
A: ALGORITHM:- 1. Take input for the number from the user. 2. Check if the number is even, odd or zero.…
Q: The date June 10, 1960, is special because when we write it in the following format, the month times…
A: since you have not mentioned the programming language, I will attempt in python. please repost again…
Q: You have just started a sales job in a department store. Your pay consists of a base salary and a…
A: Program for the given problem is define below , in this i use th java as a language and java.awt for…
Q: write a program in which ask from a user to enter name and id and show there as well. then ask again…
A: Since no programming language is mentioned, I will attempt this in python. if you need it in a…
Q: Write a program that asks for two integers and writes both the Euclidean division and the real…
A: Solution of given question :
Q: diagram last two digits of your student number (For example, if your student number is 1910602041,…
A: Here value of n is 34 So T = 34%25 = 1 i=2 j=0 i<9 -> True j=2 j<10 -> True T= T+j+i =…
Q: Write an application that gets two numbers from the user and prints the sum, product, difference and…
A: (1)First we need to Design a Java Frame and add all the components and add the listeners to the…
Q: in the United States, telephone numbers consist of a three digit area code followed by a seven digit…
A: Area codes are in 3 digits.Given that first digit cannot be zero.First digit can't be 0 it can any…
Q: The date June 10, 1960, is special because when we write it in the following format, the month times…
A: Java : Java is a class-based, object-situated programming language that is intended to have as…
Q: Input a range from user and print all the narcissistiC number in that range. Hint: A number is…
A: #include <stdio.h> #include<math.h> int main(){ //declaing variables int…
Q: Write a program that generates a plate number based on the user's answer to the following questions:…
A: PROGRAM EXPLANATION Include the header file. Define the main function. Create variables for input…
Q: a program that reads from the user two integers of three digits each The program finds the sum of…
A: import java.util.Scanner;public class MyClass { public static void main(String args[]) {…
Q: Write a program that ask the user to enter his/her letter grade and then respond with an appropriate…
A: grade = input("Enter your grade : ") #taking user inputif(grade == 'a' or grade == 'A'):…
Read in a time such as 3 pm and print the equivalent military hour (such as 15). Validate the input.
- If the input doesn’t start with an integer, print: Error: Not an integer.
- If the number isn’t between 1 and 12, print: Error: The hour must be between 1 and 12.
- If the suffix isn’t "am" or "pm", print: Error: The suffix must be am or pm.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
- Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following way: A, B, and C = 2 D, E, and F = 3 G, H, and I = 4 J, K, and L = 5 M, N, and O = 6 P, Q, R, and S = 7 T, U and V = 8 W, X, Y, Z = 9 Write a program that asks the user to enter a telephone number. The program should display the telephone number with all alphabetic characters that appeared in the original translated to their numeric equivalent. Do not translate characters other than letters. Ex: If the input is: 555-GET-food the output is: 555-438-3663 Python. Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following fashion: A, B and C = 2 D, E and F = 3 G, H and I = 4 J, K and L = 5 M, N and O = 6 P, Q, R and S = 7 T, U and V = 8 W, X, Y and Z = 9 Write a program that asks the user to enter a 10-character number in the format XXX-XXX-XXXX. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. For example, if the user enters 555-GET-FOOD, the application should display 555-438-3663. After displaying the translated telephone number, ask the user if they’d like to enter another number. If the user enters “y”, run the program again. If not, terminate the program. (10 points)Note: the sentence the program reads SHOULD NOT be hardcoded. Allow the user to enter the sentence the program reads PYTHONRead an integer value into variable num1 and another integer value into variable num2 and to do the following: if the value in variable num1 is greater than the value in variable num2 add 1 to the value in num1 add 5 to the value in num2 then print the result of the product of the new value in num1 and the new value in num2; otherwise, subtract 1from the value in num1 substract 5 from the value in num2 and then print the result of the product of the new value in num1 and the new value in num2. Is it one-way or two-way selection?Which structure to use: if or if/else? in C++
- Read an integer value into variable num1 and another integer value into variable num2 and to do the following: if the value in variable num1 is greater than the value in variable num2 add 1 to the value in num1 add 5 to the value in num2 then print the result of the product of the new value in num1 and the new value in num2; otherwise, subtract 1from the value in num1 substract 5 from the value in num2 and then print the result of the product of the new value in num1 and the new value in num2. Is it one-way or two-way selection?Which structure to use: if or if/else?Suppose you want to deposit a certain amount of money into a savings account, and thenleave it alone to draw interest for the next 10 years. At the end of 10 years, you would like tohave $10,000 in the account. How much do you need to deposit today to make that happen?You can use the following formula, which is known as the present value formula, to find out:The terms in the formula are as follows: [5 marks]• P is the present value, or the amount that you need to deposit today.• F is the future value that you want in the account. (In this case, F is $10,000.)• r is the annual interest rate.• n is the number of years that you plan to let the money sit in the account.Write a method named presentValue that performs this calculation. The method should accept the future value, annual interest rate, and number of years asarguments. It should return the present value, which is the amount that you need to deposit today.Demonstrate the method in a program that lets the user experiment with…1___5.Print the numbers from 1 to n, but for multiples of 3, print "Fizz" instead of the number, and for multiples of 5, print "Buzz". For numbers which are multiples of both 3 and 5, print "FizzBuzz"..
- Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following fashion: A, B, and C 2 D, E, and F 3 G, H, and I 4 J, K, and L 5 M, N, and O 6 P, Q, R, and S 7 T, U, and V 8 W, X, Y, and Z 9 Write a program that asks the user to enter a 10-character telephone number in the format XXX-XXX-XXXX. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. For example, if the user enters 555-GET-FOOD the application should display 555-438-3663. Gaddis Tony. Starting Out with Python (2-downloads) (p. 367). Pearson Education. Kindle Edition.in the United States, telephone numbers consist of a three digit area code followed by a seven digit local number. Suppose neither the first digit of an area code nor the first digit of a local number can be a zero but that all other choices are acceptable. do not use commas when you write your number. For example enter 3356789 NOT 3,456,789When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)
- A word is called as a good word if all the letters of the word are distinct. That is, all the letters of the word are different from each other letter. Else, the word is called as a bad word. This can be continued based on the user input is 'Y'.This Code print the first occurrences of x, Please Modify the code to print the last occurrences of x and print how many times it exists? ( with explanation for each line if possible) many thanks.Write a program that reads a four-digit integer, such as 2014, and then displays it, one digit per line in reverse order, like so: 4 1 0 2 Your prompt should tell the user to enter a four-digit integer. You can then assume that the user follows directions. (Hint: Use the division andm remainder operators.)