0% found this document useful (0 votes)
11 views5 pages

CSS 112 Group Assignment

The document outlines a group assignment for CSS 112 for the academic year 2024-2025, consisting of 12 programming questions in C. Each question involves creating a program to solve specific problems, such as managing scores for a tournament, simulating a supermarket checkout, calculating BMI, and handling banking transactions. The assignment requires collaboration in groups of 10 to 12 members, with a presentation date set between February 3 and February 7, 2025.

Uploaded by

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

CSS 112 Group Assignment

The document outlines a group assignment for CSS 112 for the academic year 2024-2025, consisting of 12 programming questions in C. Each question involves creating a program to solve specific problems, such as managing scores for a tournament, simulating a supermarket checkout, calculating BMI, and handling banking transactions. The assignment requires collaboration in groups of 10 to 12 members, with a presentation date set between February 3 and February 7, 2025.

Uploaded by

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

CSS 112 GROUP ASSIGNMENT 2024_2025

Instructions:

In a group of 10 to 12 Members work on the following questions

A group should work for one question, e.g. Grp 1 for Qn 1 Grp 2 for Qn 2, and so on ...

Presentation Date: From 03/02/2025 To 07/02/2025

QUESTION 1

Write a C program to assist Mzumbe University in managing scores for a computer


game tournament named League of Legends. The program should allow the user to
input the number of rounds and players, store the players' names, record their points
for each round, calculate the total points for each player after all rounds, and display
the results. For example, if there are 2 rounds with 3 players, the program should
prompt the user to enter their names and points for each round, then compute and
display the total points for each player.

QUESTION 2

Write a C program named supermarket.c to simulate a supermarket checkout


system with three cashiers (0, 1, and 2). Customers join the shortest queue and
prioritize cashiers in ascending order in case of ties. The program should read input
from a file supermarket.txt, where each line contains a customer's checkout time
and spending, or is empty for no arrival. Use arrays and functions to calculate and
display the average wait time, total money received, and customers served by each
cashier.

QUESTION 3

Write a C program that calculates the Body Mass Index (BMI) for a group of students
and categorizes them based on their BMI. The program should prompt the user to
input the number of students and, for each student, their name, age, height (in
meters), and weight (in kilograms). The BMI is calculated using the formula:

BMI = Weight(kg)
Height(m)2
Based on the BMI value, categorize each student as Underweight (BMI < 18.5), Normal
weight (18.5 ≤ BMI < 24.9), Overweight (25 ≤ BMI < 29.9), or Obese (BMI ≥ 30). Display
a table listing each student's name, age, height, weight, BMI, and category.
Additionally, compute and display the average BMI of the class and identify the most
frequent BMI category. Finally, allow the user to select a category (e.g., 1 for
Underweight, 2 for Normal weight, etc.) and display the names of students in that
category. Ensure the program uses arrays to store data and implements modular
programming by using functions for BMI calculation and categorization.

QUESTION 4

Design a C program to manage bus repair records for a company. The system should
allow adding new buses by recording their type, make, registration number, and
owner details, including name, billing address, gender, and contact information. It
should schedule repairs by assigning a mechanic and a helper while logging the type
of repair. Parts required for repairs should be requested from inventory and logged.
The program should calculate the total cost of repairs, including labor hours and
parts, and generate an invoice for the bus owner. It must also maintain a detailed
transaction log that records the date, transaction type (Add, Repair, Billing), repair
type, parts used, and staff involved. The system should provide clear and concise
reports of all transactions on demand. Use structured data (e.g., structs) and modular
functions to ensure an organized and efficient implementation.

QUESTION 5

Write a C program to handle the ensuing situation:

Suppose patients are visiting a hospital for medical examinations. Each patient
undergoes multiple tests (denoted by "t"). After listening to the patient's symptoms,
medical professionals decide which tests to conduct. Each test incurs a specific cost.

Your task is to write a C program that calculates the total cost of tests for each patient
and categorizes their health condition based on the total amount paid for the tests.
The categories are as follows:

Extremely sick: Total bill is Tsh2,000,000 and above

Moderately sick: Total bill is between Tsh10,000 and Tsh15,000

Okay: Total bill is below Tsh5,000


QUESTION 6

An electronic store wants to keep an inventory of the products in its store. You are
asked to write a C program that asks the user to enter the brand (string, eg. Elba),
serial number (string, eg. ELB102), type (string, eg. kettle), warranty period (int), and
the price (double) for each product. The user can enter as many products information
as needed (use a loop of your choice).

The program should do the following:

1. Identify the total and average price of all products in the inventory. 2. Display the
brand and model of the most expensive product. 3. How many kettles are in the
inventory?

QUESTION 7

Write a C program that counts the number of words and lines in a text file or from
standard input if no file is specified. The program should take either zero or one
command-line argument: no argument means reading from standard input, while
one argument specifies the file to read. If more than one argument is provided or the
file cannot be opened, the program should print an error message and exit with a
return value of -1. Using fgets(), the program reads the file line by line, and with
strtok(), it tokenizes each line into words, counting both words and lines in the
process. The processLine() function handles the processing of each line. The program
should output the total word count and line count separated by a tab and followed
by a new line. A Makefile must compile the program into an executable named hw1wc
using the -Wall flag to ensure no warnings during compilation.

QUESTION 8

Write a C program that declares a 2D array of characters with 40 rows and 80


columns to store strings supplied by the user through standard input (stdin). You
need to create several functions to manage this task: a main function that coordinates
the program, a load function that allows the user to enter sentences (up to 20
sentences or until the user signals they wish to stop), and an analysis function that
counts the total number of words and vowels (a, e, i, o, u, both lowercase and
uppercase) across all the sentences. The user’s input must be case-sensitive,
meaning you must accurately count both uppercase and lowercase vowels. The
program should keep accepting input until the user enters 20 sentences or indicates
they want to stop.
QUESTION 9

Write a C program that simulates a simple banking application with two accounts:
checking and savings. The program should initialize the balances for both accounts,
display a welcome message along with the initial balances, and provide a menu with
two options: (d) to deposit money or (q) to quit the program. If the user selects (d),
they should be prompted to choose (1) to deposit into the checking account or (2) to
deposit into the savings account. After each deposit, the program should update and
display the balances, and it should also show a record of all transactions made by
the user. The program should exit when the user selects (q) and must handle both
uppercase and lowercase input for menu options.

QUESTION 10

Write a program in C that includes recursive functions for the following tasks:

(1) Check if a given array is a palindrome. For example, arr[] = {2, 1, 1, 1, 2} and

arr[] = {'a', 'b', 'b', 'a'} are palindrome arrays, while arr[] = {1, 5, 4, 3, 2} is not.

(2) Perform operations on 2D arrays using recursion, including (a) swapping rows and
columns, (b) shifting elements of the array, and(c) finding the transpose of the array.

QUESTION 11

Write a C program to assist the head of the Computing Science Studies department at
MU in analyzing student attendance during campus elections. On election day, all
first-year students from the ICT-M, ICT-B, and ITS programs were required to vote,
and their matriculation numbers were recorded as proof of attendance. The program
should allow the user to input the matriculation numbers of all students who voted,
grouped by their respective programs. Once the data is collected, the program should
analyze and display the total number of students who voted from each program (ICT-
M, ICT-B, and ITS) and the overall total number of voters. Additionally, the program
should ensure that each matriculation number is unique and properly validate user
input to prevent errors during data entry.
QUESTION 12

Write a C program to assist RHB HQ Bank in managing and analyzing staff


preferences for their retirement schemes. A bank can have a maximum of 500 staff
members, categorized as either officers or non-officers, and each staff member is
given the option to choose between the PENSION scheme or the KWSP scheme. The
program should allow the user to input details for each staff member, including their
staff ID, category (officer or non-officer), and selected scheme (PENSION or KWSP).
Using an array to store this information, the program should then display the
complete details of all staff members, along with the total count of officers and non-
officers who have chosen the PENSION scheme and the KWSP scheme. Ensure
proper validation of inputs and efficient handling of the data to generate an output
summary, as demonstrated in the reference output format (e.g., Figure c).

You might also like