Arvutiteaduse instituut
  1. Kursused
  2. 2020/21 sügis
  3. Programmeerimise alused (MTAT.03.236)
EN
Logi sisse

Programmeerimise alused 2020/21 sügis

  • Home
  • Grading
  • Links

Homework 5

The deadline is Sunday, the 11th of October, 23:59 (Estonian time).

Exercise 1. Name and grades

Write a program that asks the user for his first name and grades. Regardless of how the user enters the name and grades (in lower and capital letters or mixed), the output of the program has to be formatted so that the name begins with the capital letter followed by lower case letters, and all the grades are in the upper case. On the next line, the program has to show the number of the grades. Next, the grade for the second course has to be shown (assume that the number of the entered grades is at least 2). On the last line, the program has to show the number of A's and B's (counted together).

Here is an example of the program output:

 Enter first name: mAriNa
 Enter grades: aaAbBcDaD
 Hello Marina, your grades are AAABBCDAD
 You have 9 grades
 Your grade for the second course is A
 The number of A's and B's is 6

Hint: Look at string functions from string library.

Exercise 2. Username from url

Every user of the University of Tartu (a student or a member of staff) has his/her home directory in the Study Information System. The user can create a webpage on the university server. The url for his/her webpage is www.ut.ee/~username/ (e.g. www.ut.ee/~vilo/). Write a program that prompts the user for a university url. The program then has to look for the user name and print it out.

Here is an example of the program output:

 Please enter url: http://www.ut.ee/~koit/KT/index_eng.html
 Username is koit

Go to Moodle and upload your solution into Homework 5.

  • Arvutiteaduse instituut
  • Loodus- ja täppisteaduste valdkond
  • Tartu Ülikool
Tehniliste probleemide või küsimuste korral kirjuta:

Kursuse sisu ja korralduslike küsimustega pöörduge kursuse korraldajate poole.
Õppematerjalide varalised autoriõigused kuuluvad Tartu Ülikoolile. Õppematerjalide kasutamine on lubatud autoriõiguse seaduses ettenähtud teose vaba kasutamise eesmärkidel ja tingimustel. Õppematerjalide kasutamisel on kasutaja kohustatud viitama õppematerjalide autorile.
Õppematerjalide kasutamine muudel eesmärkidel on lubatud ainult Tartu Ülikooli eelneval kirjalikul nõusolekul.
Courses’i keskkonna kasutustingimused