0% found this document useful (0 votes)
90 views3 pages

VU-CS504-Assignment 2

The document describes an assignment for a Software Engineering course. It includes two questions - the first asks students to create a class diagram for an app's entertainment corner based on a description, and the second asks students to choose the most appropriate architectural style for a mobile app from several options. It also includes code for a switch statement menu with some identified coding style mistakes.

Uploaded by

Ayesha Noor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views3 pages

VU-CS504-Assignment 2

The document describes an assignment for a Software Engineering course. It includes two questions - the first asks students to create a class diagram for an app's entertainment corner based on a description, and the second asks students to choose the most appropriate architectural style for a mobile app from several options. It also includes code for a switch statement menu with some identified coding style mistakes.

Uploaded by

Ayesha Noor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment No.

02
Total Marks: 20
Semester: Spring 2022
Software Engineering-1 (CS504) Due Date: 24-08-2022
Name: Ayesha Noor ID: BC210202124

Total Questions: 02 Total Marks:20


Question 1: (15)
Entertainment Corner

One very interesting feature in the entertainment corner of this app is the weather-sensed auto-
generated playlist of songs. Users can relax and enjoy the weather by listening to her playlist. For that
mobile internet and location service should be enabled. The app uses location coordinates (longitude,
latitude) to extract humidity, precipitation, air temperature, air pressure, and wind speed to predict the
current weather. A playlist of songs is created to match the current weather forecast. The user can save
the playlist for later with the title of her choice. The user has also been given the liberty to search, add
or remove any song by entering the song’s title. The device's music player will be used to play, pause,
shuffle or repeat playlist songs.

Read the paragraph above to identify the classes and attributes and create a class diagram using
UML object model notations (as discussed in Lecture 15) on StarUML or MS Visio.
Solution:
Question 2: (1)

Choose the most appropriate architectural style for the ‘HomeAide’ mobile app from the
following options.

Options:

 Client-Server Architecture
 Layered Architecture
 Pipe and Filter Architecture
 Repository architectures

Question 3: (4)
1. #include <iostream>
2. #include<string>
3. #include<cmath>
4. using namespace std;

5. int main() {
6. // Write C++ code here
7.
8. int key, age, input = 0;
9. double weight = 0; //declaring and initializing weight
10. double h = 0.0; //declaring height initializing height
11. double bodymassindex = 0.0;
12. string n; //declaring name
13.
14. cout << "Menu" << endl;
15. cout << "Press 1 for Reminder Corner " << endl;
16. cout << "Press 2 for Kitchen Corner " << endl;
17. cout << "Press 3 for Entertainment Corner " << endl;
18. cout << "Press 4 for Family Corner " << endl;
19. cout << "Press 5 for Self-Care Corner " << endl;
20. cout << "Press 6 for Groceries Corner " << endl;
21. cout << "Press 7 for Budget Corner " << endl;
22. cout << "Press 8 for Life Hacks Corner " << endl;
23. cout << "Press 9 for Housekeeping Corner " << endl;
24. cout << "Press 10 for Events Corner " << endl;
25.
26. cin >> key;
27. switch (key)
28. {
29. case 1:
30. cout << "Welcome to Reminder Corner";
31. break;
32. case 2: cout << "Welcome to Kitchen Corner"; break;
33. case 3:
34. cout << "Welcome to Entertainment Corner";
35. case 4:
36. cout << "Welcome to Family Corner";
37. break;
38. case 5:
39. cout << "Welcome to Self-care Corner" << endl;;
40. cout << "Press 1 to calculate your Body Mass Index (BMI)" <<
endl;
41. cin >> input;
42.
43. if(input == 1)
44. {
45.
46. cout << "***BMI Calculator***" << endl;
47. cout << "Enter your name" << endl;
48. cin >> n;
49. cout << "Enter your age" << endl;
50. cin >> age;
51. cout << "Enter your Height (centimeters)" << endl;
52. cin >> h;
53. cout << "Enter your weight (kg)" << endl;
54. cin >> weight;
55. bodymassindex = weight/pow((h/100),2);
56. cout << "Dear " << n << ", your BMI is " << bodymassindex
<< " " << endl;
57. cout << "Healthy BMI range: 18.5 kg/m2 - 25 kg/m2" <<
endl;
58. break;
59. }
60. else
61. {
62. break;
63. }
64. case 6:
65. cout << "Welcome to Groceries Corner";
66. break;
67. case 7:
68. cout << "Welcome to Budget Corner";
69. break;
70. case 8:
71. cout << "Welcome to Life Hacks Corner";
72. break;
73. case 9:
74. cout << "Welcome to Housekeeping Corner";
75. break;
76. case 10:
77. cout << "Welcome to Events Corner";
78. break;
79. default:
80. cout << "Settings";
81. break;

82. }
83. return 0;
84. }

Keeping in view the best coding style guidelines discussed in lectures, identify any 4 coding style
mistakes that violate best coding practices in the above code and write them in the table below.
Also, mention the line number/s where you encountered the mistake.

Sr. Line number/s Coding Style Mistakes


1 10 double h should be named double height
2 11 bodymassindex should be bodyMassIndex
3 12 string n should be named string name
4 32 break; should be on line 33
5 34 There is no break; statement for case 3.

You might also like