Epc Assignment

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Epc Assignment as PDF for free.

More details

  • Words: 1,060
  • Pages: 5
ASSIGNMENT Develop a program to do the following: Question 1 : Hieu + Phuong Display the screen as in the description: *************************************************** * Date of Examination: (dd/mm/yyyy) * * Student Name: (your fullname) * * Student Number: (your roll number) * * Batch: (your batch) * * Please select the number for appropriate tasks * * 1. Quit program * * 2. Question 2 * * 3. Question 3 * * ………… * * 8. Question 8 * *************************************************** When the number is pressed, the appropriate task should be performed: Number 1 for quitting program Number 2 for switching to the Question 2 screen Number 3 for switching to the Question 3 screen … Number N for switching to the Question N screen Question 1 Write a program which will read an integer value for a base, then read a positive integer written to that base and print its value. For example, Input Output ========== ====== 10 1234 1234 8 77 63 (the value of 77 in base 8, octal) 2 1111 15 (the value of 1111 in base 2, binary) The base will be bigger than 1 and less than or equal to 10.

Question 2 : Thuyen + Lan Read in a list of positive numbers until a 0 is encountered. Write out to the screen: - the list of numbers to be read - that list in a descending order - all the odd numbers in the list - all the even numbers in the list - the smallest number in the list - the biggest number in the list Question 3 : Thanh Read in a string of characters. Write out to the screen: • the string to be read with the number of words of the string. For e.g the input string "I'm an Aptechite" has 3 words, • whether the string is palindrome or not. For e.g. the following strings are palindrome: dennisandEdnasinned iprefferpi • the string to be read with each word on a different line For e.g. the input string "I'm an Aptechite", the output: I'm an Aptechite • the string to be read in reversed order of characters For e.g. the input string I'm an Aptechite, the output: etihcetpA na m'I

Question 4 : Chinh + Tuan Write a program to count the vowels and letters in free text given as standard input. • Read text a character at a time until you encounter a zero (0) digit (excluded). • Then print out the number of occurrences of each of the vowels a, e, i, o and u in the text, • and the total number of letters which are not vowels. • Then print out each of the vowels, • and the rest letter as integer percentages out of the letter total. Suggested output format is: Numbers of letters: a 3 ; e 2 ; i 0 ; o 1 ; u 0 ; rest 17 Percentages of total letters: a 13%; e 8%; i 0%; o 4%; u 0%; rest 75% Hint Read characters to a 0 digit using a construct such as char ch; while( ( ch = getche() ) != '0' ) { /* ch is the next character */ } Question 5 : Phuc A baby sitter is charged: • $1.50 per hour until 9:00 pm (while the kids are still up), • $1.00 per hour between 9:00 pm and midnight, • and $1.25 per hour after midnight (since late night baby sitting interferes with morning classes). Write a program that • reads the sitter's starting time in hours and minutes and the ending time in hours and minutes • and then computes the sitter's fee and output to the screen.

Assume all times are between 6:00 pm and 6:00 am, and hours should be entered as being between 0 and 12 (inclusive). Hours outside the range of 0 to 12 should be considered invalid. The hour 6 should be considered as 6:00 pm, when it is entered as a starting time. The hour 6 should be considered as 6:00 am, when it is entered as an ending time. The following table may clarify allowed time values for this problem. Data Input Meaning Starting Starting Ending Ending Starting Ending Hour Minutes Hour Minutes Time time 8 0 3 30 8:00pm 3:30am 6 0 0 45 6:00pm 12:45am 12:00am 12 0 6 0 6:00am (midnight) Question 6 : Vu • Read in three values representing respectively: o a float number Seed, o a float number Rate, and o an integer number N.

• Compute the values of Sum based on Seed, Rate for each row which starts at row 1 and end at row N. Each row is calculated as Sum = Seed + Rate * row ; • Print output row by row in a form such as: (with Seed 30000.00, 12.5 percent of Rate and for N = 10) Row 1 2 3 4 5 6 7 8

Sum 30012.50 30025.00 30037.50 30050.00 30062.50 30075.00 30087.50 30100.00

9 10

30112.50 30125.00

Question 7 : Hung +Thang Write a program to calculate the amount to be paid for electricity consumption. • Input two number- P for unit price ($ per kwh), and total kwh K consumed by customer, These are float numeric data. • Program output is the total amount to be paid by the customer. The total amount is calculated according to the following rules: o For the first 100 kwh consumed by customer, the unit price is P, o From 101st kwh to 200th , the unit price is 90% of P, o From 201st kwh to 300th , the unit price is 80% of P, o From 301st kwh up, the unit price is 75% of P.

Question 8 : Loc + Khanh Write a program to calculate the income tax based on the salary per month. • Input number is the salary S, • Program output (to the screen) is the income tax to be paid by the employee. Income tax to be calculated according to the following rules: o Salary S comes up to 5000, no tax to be paid, o For the salary portion from 5001 to 10000, 10% is paid for income tax, o For the salary portion from 10001 to 20000, 15% is paid for income tax, o For the salary portion above 20000, 20% is paid.

---o0o---

Related Documents

Epc Assignment
November 2019 19
Epc
May 2020 17
Epc
June 2020 14
Epc
June 2020 9
Epc Dethithuchanh
November 2019 18
Address Epc
June 2020 6