Previous Next
0 / 18
Module DEMO-32-91DEMO-C-32

CampusBite Smart Canteen Toolkit

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Plagiarism is a particular form of cheating. Plagiarism must be avoided at all costs and students who break the

rules, however innocently, may be penalised. It is your responsibility to ensure that you understand correct

referencing practices. As a university level student, you are expected to use appropriate references

throughout and keep carefully detailed notes of all your sources of materials for material you have used in

your work, including any material downloaded from the Internet. Please consult the relevant unit lecturer or

your course tutor if you need any further advice.

By clicking submit I certify that the assignment submission is entirely my own work and I fully understand the

consequences of plagiarism. I understand that making a false declaration is a form of malpractice

NOTE: all test cases below are for reference and to help you to test your solution, solving all testcases does not mean that you solved the assignment correctly you need to strict to the rules and notes in assignment brief

Please always refer to assignment brief file



Input Format

The first line contains activity.

  • For activity 1, the next line contains meals drinks member.
  • For activity 2, the next lines contain N, then x1 x2 ... xN, then target.
  • For activity 3, the next line contains one text item.
  • For activity 4, the next line contains R C, followed by R lines each containing C integers.

Output Format

  • Activity 1: SUBTOTAL=<value_2dp> TOTAL=<value_2dp>
  • Activity 2: MAX=<int> HIT=<int>
  • Activity 3 line 1: V=<vowels> U=<underscores>
  • Activity 3 line 2: NORM=<normalized_text>
  • Activity 4 line 1: ROWMAX K1 K2 ... KR
  • Activity 4 line 2: COLMAX L1 L2 ... LC
  • Activity 4 line 3: ZERO=<count>
  • Invalid input: invalid input

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
1
2 1 1
SUBTOTAL=10.75 TOTAL=9.68
Activity 1 sample with member discount and two-decimal rounding.
Sample #2
Public sample
1
0 4 0
SUBTOTAL=7.00 TOTAL=7.00
Activity 1 accepts zero meals when drinks is positive and no discount is applied.
Sample #3
Public sample
1
100 100 1
SUBTOTAL=625.00 TOTAL=562.50
Activity 1 upper bounds for meals and drinks.
Sample #4
Public sample
1
3 0 1
SUBTOTAL=13.50 TOTAL=12.15
Activity 1 accepts zero drinks when meals is positive.
Sample #5
Public sample
1
0 0 0
invalid input
Activity 1 rejects an empty order.
Sample #6
Public sample
1
1 1 2
invalid input
Activity 1 rejects an invalid member flag.
Sample #7
Public sample
1
101 1 0
invalid input
Activity 1 rejects meals above 100.
Sample #8
Public sample
1
1 -1 0
invalid input
Activity 1 rejects negative drinks.
Sample #9
Public sample
2
6
12 0 19 7 19 5
10
MAX=19 HIT=3
Activity 2 sample with repeated maximum values.
Sample #10
Public sample
2
1
0
0
MAX=0 HIT=1
Activity 2 minimum N and zero target.
Sample #11
Public sample
2
5
100000 99999 100000 1 0
100000
MAX=100000 HIT=2
Activity 2 upper order and target bounds.
Sample #12
Public sample
2
4
10 20 30 40
50
MAX=40 HIT=0
Activity 2 no values reach the target.
Sample #13
Public sample
2
0
0
invalid input
Activity 2 rejects N below 1.
Sample #14
Public sample
2
3
1 100001 2
2
invalid input
Activity 2 rejects an order count above 100000.
Sample #15
Public sample
2
3
1 -1 2
2
invalid input
Activity 2 rejects a negative order count.
Sample #16
Public sample
2
3
1 2 3
100001
invalid input
Activity 2 rejects target above 100000.
Sample #17
Public sample
2
3
1 2 3
-1
invalid input
Activity 2 rejects a negative target.
Sample #18
Public sample
3
iced_tea_2
V=4 U=2
NORM=ICED TEA 2
Activity 3 sample with two underscores.
Sample #19
Public sample
3
Combo_Meal#5!
V=4 U=1
NORM=COMBO MEAL#5!
Activity 3 preserves digits and punctuation.
Sample #20
Public sample
3
AEIOU_aeiou_xyz!
V=10 U=2
NORM=AEIOU AEIOU XYZ!
Activity 3 counts vowels case-insensitively.
Sample #21
Public sample
3
BCDFG123!
V=0 U=0
NORM=BCDFG123!
Activity 3 handles text with no vowels and no underscores.
Sample #22
Public sample
3
1234-_.!
V=0 U=1
NORM=1234- .!
Activity 3 replaces only underscores with spaces.
Sample #23
Public sample
3

invalid input
Activity 3 rejects an empty text line.
Sample #24
Public sample
4
3 4
1 7 3 2
0 4 4 5
6 1 0 0
ROWMAX 7 5 6
COLMAX 6 7 4 5
ZERO=3
Activity 4 sample with row maxima, column maxima, and zero count.
Sample #25
Public sample
4
1 1
0
ROWMAX 0
COLMAX 0
ZERO=1
Activity 4 minimum grid size with a zero cell.
Sample #26
Public sample
4
2 3
1000000 2 3
4 1000000 0
ROWMAX 1000000 1000000
COLMAX 1000000 1000000 3
ZERO=1
Activity 4 validates the maximum allowed cell value.
Sample #27
Public sample
4
1 4
2 9 9 0
ROWMAX 9
COLMAX 2 9 9 0
ZERO=1
Activity 4 single-row grid.
Sample #28
Public sample
4
4 1
5
0
7
7
ROWMAX 5 0 7 7
COLMAX 7
ZERO=1
Activity 4 single-column grid.
Sample #29
Public sample
4
0 3
invalid input
Activity 4 rejects R below 1.
Sample #30
Public sample
4
2 101
invalid input
Activity 4 rejects C above 100.
Sample #31
Public sample
4
1 2
4 1000001
invalid input
Activity 4 rejects a cell above 1000000.
Sample #32
Public sample
5
invalid input
The selector rejects activity numbers outside 1..4.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings