Array Programming Assignment
Part A: Single-Dimensional Arrays (7 Questions)
Question 1: Student Marks Manager
Create a program that asks the user to enter marks for 8 students and stores them in
an array. Your program should:
o Calculate and display the average mark
o Find and show the highest mark
o Find and show the lowest mark
o Count how many students passed (mark >= 50)
o Create a new array with only the failing marks
Question 2: Daily Temperature Tracker
Ask the user to enter temperatures for 7 days and store them in an array. Your
program should:
o Calculate the weekly average temperature
o Find how many days were hot days (temperature > 30)
o Find how many days were cold days (temperature < 15)
o Create a new array showing temperature differences from average
o Display days that were hotter than average
Question 3: Shopping Cart Calculator
A user enters prices of 6 items they want to buy. Store these in an array. Your
program should:
o Calculate the total cost of all items
o Apply 10% discount if total is over $100
o Find the most expensive item
o Find the cheapest item
o Show items that cost more than $20
Question 4: Word Length Analyzer
Ask the user to enter 5 words. Store them in an array. Your program should:
o Calculate the average length of all words
o Find the longest word
o Find the shortest word
o Count how many words have more than 5 letters
o Create a new array with word lengths only
Question 5: Employee Weekly Hours
Store daily work hours for one employee (Monday to Friday) in an array. Your
program should:
o Calculate total hours worked in the week
o Find which day had the most hours worked
o Calculate average daily hours
o Count how many days were long days (>8 hours)
o Show if employee worked overtime (total > 40 hours)
Question 6: Distance to Cities
Ask the user to enter distances to 5 nearby cities. Store in an array. Your program
should:
o Find the closest city (smallest distance)
o Find the farthest city (largest distance)
o Calculate average distance
o Count cities within 50 km
o Create a new array with distances in miles (km * 0.62)
Question 7: Book Title Manager
User enters 4 book titles. Store in array. Your program should:
o Find the title with most words
o Count how many titles contain "The"
o Calculate average title length
o Show titles that are longer than 10 characters
o Create new array with titles in uppercase
Part B: Two-Dimensional Arrays (7 Questions)
Question 8: Classroom Seating Chart
Create a 3x4 classroom seating array. Ask user to enter student names for each seat
(use "empty" for no student). Your program should:
o Count how many seats are occupied
o Find which row has most students
o Display all occupied seat positions
o Calculate occupancy percentage
o Show names of students in front row
Question 9: Weekly Product Sales
A shop sells 3 products. Track daily sales for 5 days using a 3x5 array. Ask user to
enter sales data. Your program should:
o Calculate total sales for each product
o Find which day had highest total sales
o Calculate average daily sales per product
o Find products that never sold zero units
o Show daily total sales
Question 10: Hotel Room Booking
A small hotel has 2 floors with 3 rooms each. Create a 2x3 array. Ask user to enter
room status:
o "A" for Available
o "O" for Occupied
o "M" for Maintenance
Your program should:
o Count available rooms on each floor
o Find floor with most occupied rooms
o Show room numbers that need maintenance
o Calculate hotel occupancy rate
o Find adjacent available rooms
Question 11: School Test Scores
Store test scores for 4 subjects across 3 tests using a 4x3 array. Ask user to enter
scores. Your program should:
o Calculate average for each subject
o Find which test was hardest (lowest average)
o Count how many scores are below 50
o Show subjects where all scores are above 70
o Calculate student's overall average
Question 12: Farm Crop Production
A farmer has 3 fields. Track monthly production (kg) for 4 months using a 3x4 array.
Ask user to enter production data. Your program should:
o Calculate total production per field
o Find the best month overall
o Calculate average monthly production
o Find fields that always produced > 100kg
o Show monthly total production
Question 13: Cinema Seat Booking
A cinema has 3 rows with 5 seats each. Create a 3x5 array. Ask user to mark seats:
o "B" for Booked
o "F" for Free
Your program should:
o Count free seats in each row
o Find row with most free seats
o Calculate total tickets sold
o Find available window seats (first and last seat of each row)
o Check if middle row has consecutive free seats
Question 14: Factory Quality Control
A factory has 4 machines. Track daily quality checks for 5 days using a 4x5 array. Ask
user to enter:
o "P" for Pass
o "F" for Fail
Your program should:
o Calculate pass rate for each machine
o Find which day had most failures
o Show machines that passed all checks
o Calculate overall success percentage
o Find machines that need attention (3+ failures)