programming exercises

Programming Exercises : if…else…elseif

These are some programming exercises that can test your brain. These programming exercise are generic and simple that could be done using any programming language you like.

  1. Write a program for a Computer Dealer company. Ask the user to choose I for Intel, A for AMD. Ask for corresponding series, Inter has 2 series available (i5 and i7) while AMD also has 2 (A-series and FX-series). Show the price of a computer with the chosen brand and series. Intel cost $300 with i5 while it cost $500 for i7. AMD cost $270 for A-series ans $480 for FX. Add a prompt to the program specify screen size (L) or small (S) monitors. Add $35  to the price of any large monitor.
  2. Write a program for a college’s admission office. Create variables to store a student’s numeric high school grade point average (example 3.2) and an admission test score. Print the message “Qualified” if the student has any of the following:
    1. A grade point average of 3.0 or above and an admission test score of 60
    2. A grade point average below 3.0 and an admission test score of at least 80
    If the student does not meet either of the qualification print “Not Qualified”
  3. Write a program that stores two integers and allows a user to enter a character. If the character is A, add the two integers. If it is S, subtract the second Integer from the first. If M, multiply the integer. If D then divide. If the second number is zero, then display error message otherwise display arithmetic result.
  4. Write a program for a barber shop that caters multiple services and discounts. Every time a customer enters the shop he will choose what kind of services he will avail. Haircut will only cost $3 and an additional service can be added after. Extra services like nail polish cost you extra $3 while massage cost you $5. The barber shop caters senior discounts that allows person 65 years old and above to have 10% discount. Display the how much is the total cost.

Sharing is caring!