Make a mark sheet of a student who is enrolled in five subjects. Marks of each subject should be defined by the user. The Output should contain the percentage obtained in each subject, Total marks obtained, Total Marks and percentage attained by the student.
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
Example 1:
Input: s = "()"
Output: true
Example 2:
Input: s = "()[]{}"
Output: true
Example 3:
Input: s = "(]"
Output: false
Example 4:
Input: s = "([)]"
Output: false
Example 5:
Input: s = "{[]}"
Output: true
*Your program output should follow the example in the instruction.
* The program should print the input parentheses and the output (true/false).
*Parentheses.txt : ((()))
Please Follow this Program to Solve the Parentheses:
#include <stdio.h>
#include <string.h>
#define mx 1000000 //max size of 10^6
int str_sz;
char str[mx];
int stk_sz;
char stack[mx];
int checker() {
stk_sz = 0;
for (int i = 0; i < str_sz; i++) {
if (str[i] == '(' || str[i] == '{' || str[i] == '[') { //if there is an opening bracket
//push it on the stack
stack[stk_sz] = str[i];
stk_sz++;
} else {
if (stk_sz == 0) return 0; //if stack is empty, return 0
switch (str[i]) {
case ')':
if (stack[stk_sz - 1] != '(') return 0;
stk_sz--;
break;
case '}':
if (stack[stk_sz - 1] != '{') return 0;
stk_sz--;
break;
case ']':
if (stack[stk_sz - 1] != '[') return 0;
stk_sz--;
break;
}
}
}
if (stk_sz > 0) return 0; //if stack is not empty, return 0
return 1;
}
int main() {
scanf("%s", str);
str_sz = strlen(str);
if (str_sz == 0) {
puts("String is empty");
return 0;
}
if (checker()) puts("Balanced");
else puts("Not balanced");
}
You are required to complete this Parentheses program template I provide and use the stack to solve the problem. Please test the program.
#include <stdio.h>
#include <stdlib.h>
// This is where the parentheses are stored in memory
char buffer[1024];
char stack_pop();
void stack_push(char ch);
int stack_size();
int main(){
FILE *fp;
// The parentheses sequences is in the parentheses.txt file.
fp=fopen("parentheses.txt","r");
if(fp==NULL){
printf("The input file does not exist.\n");
exit(-1);
}
// Read the parenthese sequences into buffer array.
fgets(buffer,1024,fp);
//printf("%s",buffer);
}
// The pop operation in the stack. To be done.
char stack_pop(){
return ')';
}
// The push operation in the stack. To be done.
void stack_push(char ch){
}
// The number of elements in the stack. To be done.
int stack_size(){
return 0;
}
Make a general store receipt of the customer who has bought several items. The Output should contain regular price of an item, the department code, and calculated the discount price. The receipt should be proper formatted using Escape sequence
Create a program that calculates your daily driving cost, so that you can estimate how much money could be saved by carpooling (car-sharing), which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The program should input the following information and display the user’s cost per day of driving to work:
a) Total miles driven per day.
b) Cost per gallon of gasoline.
c) Average miles per gallon.
d) Parking fees per day.
a) Make a program to find the diameter d=2r and area=4Πr2 or 4 pie r square of the sphere. Value of ‘r’ should be defined by the user.
Make a mark sheet of a student who is enrolled in five subjects. Marks of each subject should be defined by the user. The Output should contain the percentage obtained in each subject, Total marks obtained, Total Marks and percentage attained by the student.
) Write a program which accomplished each of the following after prompting user to typed three
integers.
Calculates the product of three integers.
Calculate the square and cube of each of the integer.
b) Make a general store receipt of the customer who has bought several items. The Output should
contain regular price of an item, the department code, and calculated the discount price. The receipt
should be proper formatted using Escape sequence
Jerri Khan established a roadside tea stall 1983. Over the years the number of customers and
products have grown. Due to the increase in the business Jerri has hired staff for various
positions including cashiers and waiter to provide service round the clock.
Jerri found that it was easier to manage the shop by himself, but since the business has grown
and number of staff are involved, he requires a mechanism to get a clear visibility of the day-to-
day operations of the shop. He has been recommended to put in a cheap computer with a
software for the cashier’s desk.
Generally, people walk into the shop and take any available seat. The order is taken by the
waiter. The customers can choose any item(s) mentioned in the menu (sample as follows).
The customers need to settle the bill as the cashier’s counter before leaving the premises. The
cashier enters the items ordered by the customers into the system. This helps keep the detailed
record of sales. A sample of the receipt is as follows:
You are required to write console mode applications using C Programming for the following
tasks.
Task #1 Marks
Write a to create a catalogue of products that are sold in the shop. The situation requires that you
allow Jerri to:
1. Add Items by Entering in real time.
2. Add Items by Importing from plain text file
3. Remove a single item
4. Remove all items
Make sure that the items are uniquely identifiable.
Task #2 Marks
Write a program for the cashier(s) to allow them to record day-to-day transaction. The program
should allow the cashier to add items to invoice from the catalogue created in Task #1. The
invoice should contain:
1. List of items purchased by the customer
2. Unit price of each item
3. Quantity purchased
4. Subtotal of each item
5. Total Value of all items purchased.
Task #3 Marks
Write a program that will allow Jerri to generate summarized report of the daily transaction. The
report should contain following:
1. Quantity of the items sold for every item on the catalogue
2. Total of amount sales in Rupees for every item on the catalogue
3. Sum of All the daily sales
Task #4 Marks
1. Write a user manual for Task #1, Task #2, and Task #3.
Create user manuals to help train Jerri and the cashiers to use the system.
1. Write a technical documentation for Task #1, Task #2, and Task #3.
Jerri Khan Roadside Tea Stall
to the increase in the business Jerri has hired staff for various positions including cashiers and waiter to provide service round the clock.
Jerri found that it was easier to manage the shop by himself, but since the business has grown and number of staff are involved, he requires a mechanism to get a clear visibility of the day-to-day operations of the shop. He Jerri Khan established a roadside tea stall 1983. Over the years the number of customers and products have grown. Due has been recommended to put in a cheap computer with a software for the cashier’s desk.
Generally, people walk into the shop and take any available seat. The order is taken by the waiter. The customers can choose any item(s) mentioned in the menu (sample as follows).
The customers need to settle the bill as the cashier’s counter before leaving the premises. The cashier enters the items ordered by the customers into the system. This helps keep the detailed record of sales. A sample of the receipt is as follows:
You are required to write console mode applications using C Programming for the following tasks.
Task #1 Marks 10
Write a to create a catalogue of products that are sold in the shop. The situation requires that you allow Jerri to:
Make sure that the items are uniquely identifiable.
Task #2 Marks 10
Write a program for the cashier(s) to allow them to record day-to-day transaction. The program should allow the cashier to add items to invoice from the catalogue created in Task #1. The invoice should contain:
Task #3 Marks 10
Write a program that will allow Jerri to generate summarized report of the daily transaction. The report should contain following:
Task #4 Marks 10
Create user manuals to help train Jerri and the cashiers to use the system.
Describe all the programs in detail.