-
Notifications
You must be signed in to change notification settings - Fork 6
/
Recap
125 lines (104 loc) · 6.64 KB
/
Recap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
## Conditionals
/// <summary>
/// Write a program and ask the user to enter a number.
/// The number should be between 1 to 10. If the user enters
/// a valid number, display "Valid" on the console.
/// Otherwise, display "Invalid". (This logic is used a lot in
/// applications where values entered into input boxes need to be validated.)
/// </summary>
/// <summary>
/// Write a program which takes two numbers from the console and displays the maximum of the two.
/// </summary>
/// <summary>
/// Write a program and ask the user to enter the width and height of an image. Then tell if the image
/// is landscape or portrait. Use an enum for in which to group the landscape and portrait orientations
/// </summary>
/// <summary>
/// Your job is to write a program for a speed camera. For simplicity, ignore the details such as camera, sensors,
/// etc and focus purely on the logic. Write a program that asks the user to enter the speed limit. Once set,
/// the program asks for the speed of a car. If the user enters a value less than the speed limit, program should
/// display Ok on the console. If the value is above the speed limit, the program should calculate the number of
/// penalty points. For every 5km/hr above the speed limit, 1 penalty point should be incurred and displayed on
/// the console. If the number of penalty points is above 12, the program should display License Suspended.
/// </summary>
## Lists
///<pattern>
/// 1) John, Mary and 3 others like your post
/// 2) John and Mary like your post
/// 3) John likes your post
/// </pattern>
/// <summary>
/// Write a program and continuously ask the user to enter different names, until the user presses Enter
/// (without supplying a name). Depending on the number of names provided, display a message based on the above pattern.
/// </summary>
/// <summary>
/// Ask the user to enter their name. Use an array to reverse the name and then store the result in a new string.
/// Display the reversed name on the console.
/// </summary>
/// <summary>
/// Write a program and ask the user to enter 5 numbers. If a number has been previously entered, display
/// an error message and ask the user to re-try. Once the user successfully enters 5 unique numbers, sort them
/// and display the result on the console.
/// </summary>
/// <summary>
/// Write a program and ask the user to continuously enter a number or type "Quit" to exit. The list of numbers may
/// include duplicates. Display the unique numbers that the user has entered.
/// </summary>
/// <summary>
/// Write a program and ask the user to supply a list of comma separated numbers (e.g 5, 1, 9, 2, 10). If the list is
/// empty or includes less than 5 numbers, display "Invalid List" and ask the user to re-try; otherwise, display
/// the 3 smallest numbers in the list.
/// </summary>
## Loops
/// <summary>
/// Write a program to count how many numbers between 1 and 100 are divisible by 3 with no remainder.
/// Display the result on the console.
/// </summary>
/// <summary>
/// Write a program and continuously ask the user to enter a number. The loop terminates when the user
/// enters “ok". Calculate the sum of all the previously entered numbers and display it on the console.
/// </summary>
/// <summary>
/// Write a program which takes a single number from the user,
/// calculates the factorial and prints the value on the console.
/// For example, if the user enters 5, the program should calculate 5 x 4 x 3 x 2 x 1
/// and display it as 5! = 120(result of 5 x 4 x 3 x 2 x 1).
/// </summary>
/// <summary>
/// Write a program that picks a random number between 1 and 10. Give the user 4 chances to guess the number.
/// If the user guesses the number, display “You won". Otherwise, display “You lost".
/// </summary>
/// <summary>
/// Write a program and ask the user to enter a series of numbers separated by comma. Find the maximum of the
/// numbers and display it on the result. For example, if the user enters “5, 3, 8, 1, 4", the program should
/// display 8 on the console.
/// </summary>
## Strings
/// <summary>
/// Write a program and ask the user to enter a few numbers separated by a hyphen(minus). Work out
/// if the numbers are consecutive. For example, if the input is "5-6-7-8-9" or "20-19-18-17-16",
/// display a message: "Consecutive"; otherwise, display "Not Consecutive".
/// </summary>
/// <summary>
/// Write a program and ask the user to enter a few numbers separated by a hyphen(minus). If the user simply
/// presses Enter without supplying an input, exit immediately; otherwise, check to see if there are
/// any duplicates. If so, display "Duplicate" on the console.
/// </summary>
/// <summary>
/// Write a program and ask the user to enter a time value in the 24-hour time format (e.g. 19:00).
/// A valid time should be between 00:00 and 23:59. If the time is valid, display "Ok"; otherwise,
/// display "Invalid Time". If the user doesn't provide any values, consider it as invalid time.
/// </summary>
/// <summary>
/// Write a program and ask the user to enter a few words separated by a space. Use the words to
/// create a variable name with PascalCase convention. For example, if the user types:
/// "number of students", display "NumberOfStudents". Make sure the program is not dependent on
/// the casing of the input. So if the input is "NUMBER OF STUDENTS", it should still display
/// "NumberOfStudents". If the user doesn't supply any words, display "Error".
/// </summary>
/// <summary>
/// Write a program and ask the user to enter an English word. Count the number of vowels
/// (a, e, o, u, i) in the word. So, if the user enters "inadequate", the program should display
/// 6 on the console. Make sure the program calculates the number of vowels irrespective of the
/// casing of the word (eg "Inadequate", "inadequate" and "INADEQUATE" all include 6 vowels).
/// </summary>