Write an if-else statement that if userTickets is greater than 5, executes award Points = 15 Else, execute award Points = user Tickets. Ex: If user Tickets is 14, then award Points = 15.
Develop a C++ program that will compute the values of six trigonometric functions (sine, cosine, tangent, cotangent, secant, and cosecant) at any angle without using cmath/math.h library. (Hint : Transform Maclaurin Series of sine and cosine function into C++ codes)
Using a while loop: Write a program to print integers 1-50 and their cubes.
1. Create a java program that will count all words in a sentence. The program should have a
minimum of two classes.
1.1 The first class should be named class1, this class will have the following:
The main method (starting point) (5)
The object of class2 (5)
Should also call the get method count_words(String str) (5)
1.2 The second class should be named class2, this class should have the following:
A constructor (5)
A get method named count_words(String str) (10)
1.3 Construct a flowchart for class1 and class2 both combined.
Delete a word from the given string. Popup a message if the string is empty.
Write a program that will ask user to enter a digit character (i.e. ‘0’ or ‘1’ .... or ‘9’). If user
enters a non-digit character then the program should display message to re-enter correct input. If user
enters a correct character (i.e. a digit character) then your program should convert that character to
a same digit but in integer type. Do this for five inputs. Finally, add all digits and display their sum. Do
not use any library function or loops.
You will have to take 5 numbers between 0-9 as input and calculate their sum. Keep in mind that the input you are taking is a character. You somehow have to convert it to the corresponding number. Then you will print strings based on the value of the sum you calculated. You will have to follow the pseudo-code given below –
While taking the inputs, you will have to print appropriate input prompts. You will first print ”Enter the first number: ” (there is a space after colon) and take the input in the same line. Then in the next line you will print ”Enter the second number: ” and take the second number as input in the same line. You will do the same for third, fourth and fifth numbers
Marks
Combined right angle triangle:
Sample input: 4
1st half:
1 2 3 4
5 6 7
8 9
10
2nd half:
17 18 19 20
14 15 16
12 13
11
Output should be combined pattern:
Combined pattern:
1 2 3 4 17 18 19 20
5 6 7 14 15 16
8 9 12 13
10 11
A New Telephone Company has the following rate structure for long distance calls:
● The regular rate for a call is $0.10 per minute. (10 marks)
● Any call started at or after 6:00P.M. (1800 hours) but before 8:00A.M. (0800 hours) is
discounted 50 percent.
● Any call longer than 60 minutes receives a 15 percent discount on its cost (after any other
discount is subtracted).
● All calls are subject to a 4 percent federal tax on their final cost.
Programming Fundamentals – Assignment 1 (Spring 2022)
Write a program that reads the start time for a call based on a 24-hour clock and the length of the call.
The gross cost (before any discounts or tax) should be printed, followed by the net cost (after discounts
are deducted and tax is added). Print instructions to the user and compute the net cost. without using loops, functions
Repeated Numbers
Eren wants to decode a number.After lots of trial and error, he finally figured out that the number is a count of repeated single-digit integers.
Write a program to help Eren print the decoded number given a string of integers N.
Input
The first line contains a string of integers N.
Output
The output contains a single integer representing count of repeated numbers in the input.
Explanation
For N = 212311 ,
1 and 2 are repeated.Therefore, the output is 2.
Sample Input1
212311
Sample Output1
2
Sample Input2
111
Sample Output2
1
Note: This site already given answer but it was not executin
answer:
N = input()
digits = [0]*10
for ch in N:
d = int(ch)
digits[d] += 1
cnt = 0
for d in digits:
if d > 1:
cnt += 1
print(cnt)
error:
Traceback (most recent call last):
File "main.py", line 5, in <module>
d = int(ch)
ValueError: invalid literal for int() with base 10: ' '