You are on page 1of 29

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

INTRODUCTION
C is a computer programming language. That means that you can use C to create lists of instructions for a computer to follow. C is one of thousands of programming languages currently in use. C has been around for several decades and has won widespread acceptance because it gives programmers maximum control and efficiency. C is an easy language to learn. It is a bit more cryptic in its style than some other languages, but you get beyond that fairly quickly. C is what is called a compiled language. This means that once you write your C program, you must run it through a C compiler to turn your program into an executable that the computer can run (execute). The C program is the human-readable form, while the executable that comes out of the compiler is the machine-readable and executable form. C has now become a widely used professional language for various reasons.

It has high-level constructs. It can handle low-level activities. It produces efficient programs. It can be compiled on a variety of computers.

Its main drawback is that it has poor error detection which can make it off putting to the beginner. However diligence in this matter can pay off handsomely since having learned the rules of C we can break them. Not many languages allow this. This if done properly and carefully leads to the power of C programming. In this project, techniques of the C programming language have been used to create a system to control a simulated washing machine using structured programming.

1|Page

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

OBJECTIVE
The objective of this assignment is to create a system to control a simulated washing machine. On the control panel of the washing machine unit are several buttons (each represented with a letter) that operate as shown below: O On / Off button By default the button is in Off state. When, in this state, and the O button is selected, the machine is in On state. When in On state, and the O button is selected, it is changed to the Off state and all entries prior to this are reset to original state.

Main Menu Once the machine is turned On (using the On / Off button) the user will have the option of deciding whether to Wash Clothes (W) or View Log (V). Wash Clothes Once this option is selected, the Load Capacity Menu appears. View Log When this option is selected, the user would be able to view the washing machine operation logs according to the dates.

Load Capacity Menu Here the user will need to select the size of the load from the Load Capacity Menu, which could include any one of the following options: S Small M Medium L Large X Extra Large F Free Load If the user is not sure on which size to select (s)he has the option to choose F (Free Load). This means that the user would depend on the machine to determine the Load Capacity based on the weight of the clothes. The weight of the clothes can be a random generated value but its value
2|Page INTRODUCTION TO C PROGRAMMING U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

has to be a logical weight for clothes put into a washing machine. When the weight is determined then the Load Capacity is set automatically to Small, Medium, Large or Extra Large. Note that there should be a minimum and maximum value for each Load Capacity type. E.g. Small should between 1 2 kg, etc. Wash Menu When the size of the load has been determined, the Wash Menu is activated. The user now gets to select from one of the following Wash Menu options: F Full Wash W Wash R Rinse S Spin

Full Wash A Full Wash would consist of Washing, Rinsing and Spinning but may include Soak depending on the selection made in the Soak Menu which appears when the Full Wash is activated. In the Soak Menu the user has the option to select from the following: N No soaking S Soak When the user selects N, the program will proceed to the next menu option Temperature Menu. If the selects S, the system will prompt the user for the number of minutes to soak. The user can key in any value between 1 60 minutes. After the number of minutes is determined the program will proceed to the next menu option Temperature Menu.

Wash The Wash would consist of only Washing without rinsing or spinning. However, it may include Soak depending on the selection made by the user from the Soak Menu which appears when the Wash is activated. The description of the Soak Menu is as listed above.

Rinse The Rinse would consist of only Rinsing without washing, spinning or soaking. The user would not have the option of selecting the temperature as well.
3|Page INTRODUCTION TO C PROGRAMMING U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

Spin The Spin would consist of only spinning without washing, rinsing or soaking. The user would not have the option of selecting the temperature as well.

Temperature Menu This menu is activated only after either the Full Wash or the Wash option has been selected. The Temperature Menu contains the following option: H Hot C Cold If the user selects H, hot water will be used for all operations from soaking to rinsing. Or else cold water will be used. Once all the necessary inputs have been provided to the washing machines system, the program provides the user with the estimated time of completing the wash as programmed and all these details are stored in a log.

DESIGN OF THE PROGRAM


Before writing the program to this particular problem, it is essential to have a thorough understanding of the problem so as to develop a carefully planned approach to solve the problem. The two main techniques used to develop an algorithm here are pseudo codes and flowcharts. Pseudo code is an artificial and informal language that will help in developing an algorithm that will be converted to a C program.

4|Page

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

Pseudo code:
Pseudo code is an outline of a program, written in a form that can easily be converted into real programming statements. It consists of short, English phrases used to explain specific tasks within a program's algorithm. Pseudo code should not include keywords in any specific computer languages. It should be written as a list of consecutive phrases. You should not use flowcharting symbols but you can draw arrows to show looping processes. Indentation can be used to show the logic in pseudo code as well. Pseudo code cannot be compiled nor executed, and there are no real formatting or syntax rules. It is simply one step - an important one - in producing the final code. The benefit of pseudo code is that it enables the programmer to concentrate on the algorithms without worrying about all the syntactic details of a particular programming language. In fact, you can write pseudo code without even knowing what programming language you will use for the final implementation. Why is pseudo code necessary? The programming process is a complicated one. You must first understand the program specifications, of course, Then you need to organize your thoughts and create the program. This is a difficult task when the program is not trivial (i.e. easy). You must break the main tasks that must be accomplished into smaller ones in order to be able to eventually write fully developed code. Writing pseudo code WILL save you time later during the construction & testing phase of a program's development.

Flowcharts:
A flowchart is a diagrammatic representation that illustrates the sequence of operations to be performed to get the solution of a problem. Flowcharts are generally drawn in the early stages of formulating computer solutions. Flowcharts facilitate communication between programmers and business people. These flowcharts play a vital role in the programming of a problem and are quite helpful in understanding the logic of complicated and lengthy problems. Once the flowchart is drawn, it becomes easy to write the program in any high level language. Often we
5|Page INTRODUCTION TO C PROGRAMMING U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

see how flowcharts are helpful in explaining the program to others. Hence, it is correct to say that a flowchart is a must for the better documentation of a complex program.

The benefits of flowcharts are as follows: 1. Communication: Flowcharts are better way of communicating the logic of a system to all concerned. 2. Effective analysis: With the help of flowchart, problem can be analysed in more effective way. 3. Proper documentation: Program flowcharts serve as a good program documentation, which is needed for various purposes. 4. Efficient Coding: The flowcharts act as a guide or blueprint during the systems analysis and program development phase. 5. Proper Debugging: The flowchart helps in debugging process. 6. Efficient Program Maintenance: The maintenance of operating program becomes easy with the help of flowchart. It helps the programmer to put efforts more efficiently on that part The limitations of flowcharts: 1. Complex logic: Sometimes, the program logic is quite complicated. In that case, flowchart becomes complex and clumsy. 2. Alterations and Modifications: If alterations are required the flowchart may require redrawing completely. 3. Reproduction: As the flowchart symbols cannot be typed, reproduction of flowchart becomes a problem. 4. The essentials of what is done can easily be lost in the technical details of how it is done.

6|Page

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

In this program design we decided to use the PSEDOCODE MAIN MENU BEGIN Load all operations Display main menu IF user selects option 'O' Turn system on and display menu selection IF user selects option 'N' Exit the system ELSE Display Error Message END IF

MENU SELECTION Display Menu selection IF user selects option 'W' Prompt user to select load capacity IF user selects option 'V' Display the washing machine operation logs IF user selects option 'T' Exit the system and reset to original state ELSE Display Error Message END IF END IF

LOAD CAPACITY MENU Display Load Capacity menu IF user selects option 'S' Prompt user to select type of wash from the wash menu IF user selects option 'M' Prompt user to select type of wash from the wash menu

7|Page

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

IF user selects option 'L' Prompt user to select type of wash from the wash menu IF user selects option 'X' Prompt user to select type of wash from the wash menu IF user selects option 'F' Prompt user to select type of wash from the wash menu ELSE Display Error Message END END END END END IF IF IF IF IF

IF user selects option 'B' Return to menu selection and prompt user to select from the menu END IF

WASH MENU Display Wash Menu IF user selects option 'F' Display Soak Option menu and prompt user to select whether to soak or not IF user selects option 'W' Display Soak Option menu and prompt user to select whether to soak or not IF user selects option 'R' Inform user that rinsing has started and save the commands into the log IF user selects option 'S' Inform user that spinning has started and save the commands into the log END END END END IF IF IF IF INTRODUCTION TO C PROGRAMMING U.C.T.I

8|Page

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

IF user selects option 'L' Return to Load Capacity menu and prompt user to select from the menu END IF

SOAK OPTION MENU Display Soak Option menu IF user selects option 'N' Display Temperature menu and prompt user to select either hot or cold IF user selects option 'S' Display Time Menu and prompt user to key in the number of minutes to soak Display Temperature menu and prompt user to select either hot or cold END IF END IF

TEMPERATURE MENU Display Temperature menu IF user selects option 'H' Inform user that washing has started and save the commands into the log IF user selects option 'C' Inform user that washing has started and save the commands into the log END IF END IF RESETING THE MACHINE After every wash Resets the system Display Menu selection END

9|Page

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

Programming Features of C Implemented


Arrays
An array in C Programming Language can be defined as number of memory locations, each of which can store the same data type and which can be references through the same variable name. An array is a collective name given to a group of similar quantities. These similar quantities could be percentage marks of 100 students, number of chairs in home, or salaries of 300 employees or ages of 25 students. Thus an array is a collection of similar elements. These similar elements could be all integers or all floats or all characters etc. Usually, the array of characters is called a string, where as an array of integers or a float is called simply an array. All elements of any given array must be of the same type i.e. we cant have an array of 10 numbers, of which 5 are ints and 5 are floats. Arrays and pointers have a special relationship as arrays use pointers to reference memory locations.

Functions
The basic philosophy of function is divide and conquer by which a complicated tasks are successively divided into simpler and more manageable tasks which can be easily handled. A program can be divided into smaller subprograms that can be developed and tested successfully. A function is a complete and independent program which is used (or invoked) by the main program or other subprograms. A subprogram receives values called arguments from a calling program, performs calculations and returns the results to the calling program. There are many advantages in using functions in a program they are: 1. It facilitates top down modular programming. In this programming style, the high level logic of the overall problem is solved first while the details of each lower level functions is addressed later. 2. The length of the source program can be reduced by using functions at appropriate places. This factor is critical with microcomputers where memory space is limited. 3. It is easy to locate and isolate a faulty function for further investigation. 4. A function may be used by many other programs this means that a c programmer can build on what others have already done, instead of starting over from scratch. 5. A program can be used to avoid rewriting the same sequence of code at two or more locations in a program. This is especially useful if the code involved is long or complicated. 6. Programming teams does a large percentage of programming. If the program is divided into subprograms, each subprogram can be written by one or two team members of the team rather than having the whole team to work on the complex program

The washing machine system has been divided into small blocks of functions that perform specific tasks when called. 10 | P a g e INTRODUCTION TO C PROGRAMMING U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

Pointers
Each memory location that we use to store the data has an address in computer memory (RAM). Computer Hardware i.e. CPU uses this address to reference to a particular data item. A pointer is a variable that stores the address of another variable. A pointer is a variable that represents the location of a data item, such as a variable or an array element. Pointers are used frequently in C, as they have a number of useful applications. For example, pointers can be used to pass information back and forth between a function and its reference point. Pointers provide a way to return multiple data items from a function via function arguments to be specified as arguments to a given function. Pointers are also closely associated with arrays and therefore provide an alternate way to access individual array elements. Within the computers memory, every stored data item occupies one or more adjacent memory cells. The number of memory cells required to store a data item depends on the type of data item. For example, a single character will be stored in 1 byte of memory integer usually requires two adjacent bytes, a floating point number may require four adjacent bytes.

Structures
Arrays are used to store large set of data and manipulate them but the disadvantage is that all the elements stored in an array are to be of the same data type. If we need to use a collection of different data type items it is not possible using an array. When we require using a collection of different data items of different data types we can use a structure. Structure is a method of packing data of different types. A structure is a convenient method of handling a group of related data items of different data types. The keyword struct begins every structure definition. The machine washing system uses a structure named wash menu which holds the details of four different fields. These are members of the structure. Each member may belong to a different data type. The tag name can be used to define objects that have the tag names structure. The structure declared in the program we just declared is not a variable by itself but a template for the structure.

Files
Storage of data in variables and arrays is temporary in that all data is lost when a program terminates. Files are used for permanent retention of data. In the washing machine program, the washing details of every wash are saved in the computer secondary storage device and displayed when view log is invoked. 11 | P a g e INTRODUCTION TO C PROGRAMMING U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

SOURCE CODE OF THE PROGRAM


// Washing_Machine.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include<windows.h> system("cls"), and so on #include<time.h> #include <stdarg.h> //#define washLimit 10 struct MACHINE { char washDate[50]; char capacityLoad[30]; char washType[20]; char soakOption[15]; char washTemprature[10]; }machine; void void void void void void void void void void void MainMenu(); LoadCapacityMenu(); WashMenuOptions(); FullWashOptions(); SoakOptions(); TemperatureMenu(); timeMenu(); viewLog(); SaveinLog(); Rinse(); Spin();

//Input/Output functions // String processing functions // it can use some speical code, just as

void WriteFormatted (FILE *, char *, ...); void PrintFError (char *, ...); int main() { char select; char washDate[50]; time_t now; now = time(NULL); printf("\t\t-------------WELCOME TO WASHING MACHINE--------------\n"); printf("\n\t\t\t %s",asctime(localtime(&now))); printf("\n\n\t\tThe washing machine is off.Would you like to turn it on? :");

12 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

printf("\n\t\t*[O] ----- Turn on "); printf("\n\t\t*[N] ----- No -(Exit) "); printf("\n\n\tPlease type the letters O or N to select your choice from above :"); fflush(stdin); scanf("%s",&select); switch(select) { case 'O' : case 'o': system("cls"); strcpy(machine.washDate,asctime(localtime(&now))); MainMenu();break; case 'N' : case 'n': printf("\nYOU HAVE CHOSEN TO QUIT THE SYSTEM");system("pause");system("cls");exit(0);break; default:system("cls"); printf("\a\n\nThe input is wrong.Please make sure to key in either P or N only. Thank you.\n\n");main(); } return 0; } void MainMenu() { char menuSelection; system("cls"); printf("\n\n\t\tThe washing machine is now on. \n\t\tPlease select what you would wish to do"); printf("\n\t\t***[W] ----- Wash Clothes --------------"); printf("\n\t\t***[V] ----- View Log --------------"); printf("\n\t\t***[T] ----- Turn Off --------------"); printf("\n\nPlease type the letters W,V or T to select your choice from above :"); fflush(stdin); scanf("%s",&menuSelection); switch(menuSelection) { case 'W' : case 'w': system("cls");LoadCapacityMenu();break; case 'V' : case 'v': system("cls");viewLog();break; case 'T' : case 't': printf("\nYOU HAVE CHOSEN TO TURN OFF THE WASHING MACHINE");system("pause");system("cls");exit(0);break; default:system("cls"); printf("\a\n\nThe input is wrong.Please make sure to key in either W or v only. Thank you.\n\n"); MainMenu(); } } void LoadCapacityMenu() { char LoadCapacitySelection; char capacitySelection [30];

13 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

int noOfWash = 0; int * mypointer; printf("\n\n\t\tPlease select the size of the load of your washing."); printf("\n\t\t*[S] ----- Small printf("\n\t\t*[M] ----- Medium printf("\n\t\t*[L] ----- Large printf("\n\t\t*[X] ----- Extra Large printf("\n\t\t*[F] ----- Free Load printf("\n\t\t*[B] ----- Back to Main Menu printf("\n\n\tPlease type the letters S,M,L,X,F or select your choice from above :"); fflush(stdin); scanf("%s",&LoadCapacitySelection); switch(LoadCapacitySelection) { case 'S' : case 's': system("cls"); strcpy(capacitySelection, "Small"); strcpy(machine.capacityLoad, capacitySelection);WashMenuOptions();break; case 'M' : case 'm': system("cls"); strcpy(capacitySelection, "Medium");strcpy(machine.capacityLoad, capacitySelection); WashMenuOptions();break; case 'L' : case 'l': system("cls"); strcpy(capacitySelection, "Large"); strcpy(machine.capacityLoad, capacitySelection); WashMenuOptions();break; case 'X' : case 'x': system("cls"); strcpy(capacitySelection, "Extra Large");strcpy(machine.capacityLoad, capacitySelection); WashMenuOptions();break; case 'F' : case 'f': system("cls"); strcpy(capacitySelection, "Free Load");strcpy(machine.capacityLoad, capacitySelection); WashMenuOptions();break; case 'B' : case 'b': system("cls");MainMenu();break; default:system("cls"); printf("\a\n\nThe input is wrong.Please make sure to key in either S,M,L,X,F or B only. Thank you.\n\n"); LoadCapacityMenu(); } LoadCapacityMenu(); } void WashMenuOptions() { char washMenuSelection; char washSelection[20]; printf("\n\n\t\tPlease select printf("\n\t\t\t*[F] ----printf("\n\t\t\t*[W] ----printf("\n\t\t\t*[R] ----an option from the wash menu below:"); Full Wash "); Wash "); Rinse "); "); "); "); "); "); "); B only.to

14 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

printf("\n\t\t\t*[S] ----- Spin "); printf("\n\t\t\t*[L] ----- Back to Load Capacity Menu "); printf("\n\n\tPlease type the letters F,W,R,S or L only to select your choice from above :"); fflush(stdin); scanf("%s",&washMenuSelection); switch(washMenuSelection) { case 'F' : case 'f': system("cls");strcpy(washSelection, "Full Wash"); strcpy(machine.washType, washSelection);SoakOptions();break; case 'W' : case 'w': system("cls");strcpy(washSelection, "Wash");strcpy(machine.washType, washSelection);SoakOptions();break; case 'R' : case 'r': system("cls");strcpy(washSelection, "Rinse");strcpy(machine.washType, washSelection);Rinse();break; case 'S' : case 's': system("cls");strcpy(washSelection, "Spin");strcpy(machine.washType, washSelection);Spin();break; case 'L' : case 'l': system("cls");LoadCapacityMenu();break; default:system("cls"); printf("\a\n\nThe input is wrong.Please make sure to key in either F,W,R,S or L only. Thank you.\n\n"); WashMenuOptions(); } WashMenuOptions(); } void SoakOptions() { char SoakOptionSelection; char soakSelection[15]; printf("\n\n\t\tPlease choose if you would like to soak your clothes or not:"); printf("\n\t\t\t*[N] ----- No Soaking "); printf("\n\t\t\t*[S] ----- Soak "); printf("\n\t\t\t*[W] ----- Wash Menu Option "); printf("\n\n\tPlease type the letters N,S or W only to select your choice from above :"); fflush(stdin); scanf("%s",&SoakOptionSelection); switch(SoakOptionSelection) { case 'N' : case 'n': system("cls");strcpy(soakSelection, "No Soaking");strcpy(machine.soakOption, soakSelection);TemperatureMenu();break; case 'S' : case 's': system("cls");strcpy(soakSelection, "Soak");strcpy(machine.soakOption, soakSelection);timeMenu();break; case 'W' : case 'w': system("cls");WashMenuOptions();break;

15 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

default:system("cls"); printf("\a\n\nThe input is wrong.Please make sure to key in either N,S or W only. Thank you.\n\n"); } } void timeMenu() { char SoakOptionSelection; int soakingMinutes; printf("\n\n\t\tPlease key in the number of minutes for soaking:"); scanf("%d",&soakingMinutes); if(soakingMinutes < 1|| soakingMinutes > 60) { printf("\a\n\nThe input is wrong.Please key in soaking minutes in the ranges of 1 - 60\n\n"); } else { TemperatureMenu(); } system("pause");system("cls");timeMenu(); } void TemperatureMenu() { char TemperatureSelection; char wash_Temperature[10]; printf("\n\n\t\tPlease choose a suitable temperature for your wash:"); printf("\n\t\t\t*[H] ----- Hot "); printf("\n\t\t\t*[C] ----- Cold "); printf("\n\n\tPlease type the letters H or C only to select your choice from above :"); fflush(stdin); scanf("%s",&TemperatureSelection); switch(TemperatureSelection) { case 'H' : case 'h': system("cls");printf(" Hot Wash strcpy(wash_Temperature, "Hot");strcpy(machine.washTemprature, wash_Temperature);break; ");

16 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

case 'C' : case 'c': system("cls");printf(" Cold Wash "); strcpy(wash_Temperature, "Cold");strcpy(machine.washTemprature, wash_Temperature);break; default:system("cls"); printf("\a\n\nThe input is wrong.Please make sure to key in either H or C only. Thank you.\n\n"); TemperatureMenu(); } printf("\n\n\t\tWashing Started..........:\n\n\n"); system("pause"); system("cls"); SaveinLog(); MainMenu(); } void Rinse() { printf("\n\n\t\tRinse Started..........:\n\n\n"); system("pause"); system("cls"); SaveinLog(); MainMenu();

} void Spin() { printf("\n\n\t\tSpin Started..........:\n\n\n"); system("pause"); system("cls"); SaveinLog(); MainMenu(); } void viewLog() { //char menuSelection; printf("\n\n\t\tView Log Details.......\n\n"); char fileLog[30]; FILE *machineWashLog; machineWashLog=fopen("machineLog.txt","r"); TEMPERATURE printf("DATE\t\t\t \n\n"); CAPACITY WASH TYPE SOAK OPTION

fgets (fileLog , 40 , machineWashLog);

17 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM puts (fileLog); for(int washItems=0;washItems<2;washItems++) { fgets (fileLog , 40 , machineWashLog); puts(" "); puts (fileLog); puts(" "); } fclose(machineWashLog); system("pause"); MainMenu();

GROUP ASSIGNMENT

} void SaveinLog() { FILE *machineWashLog; machineWashLog=fopen("machineLog.txt","a"); WriteFormatted(machineWashLog,"%s%s%s%s%s",machine.washDate, machine.capacityLoad, machine.washType, machine.soakOption,machine.washTemprature); fclose(machineWashLog); printf("\n\n\t\tWASH INSERTED INTO LOG.\n\n"); system("pause"); } void PrintFError (char * format, ...) { char buffer[256]; va_list args; va_start (args, format); vsprintf (buffer,format, args); perror (buffer); va_end (args); } void WriteFormatted (FILE * stream, char * format, ...) { va_list args; va_start (args, format); vfprintf (stream, format, args); va_end (args); }

18 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

SAMPLE OUTPUTS OF THE PROGRAM WHEN EXECUTED Screen Shots


The following windows display the outputs that are generated during the entire execution of the washing machine program.

Fig 1: Main Menu

Fig 1 shows the main menu which is the first window to be displayed when the program is executed.

Fig 2

The figure above displays the message generated when the user enters the wrong input. Fig 3

19 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

The figure above displays the wash menu when the user selects O in Fig 2 Fig 4

The figure above displays the machine turning off when the user decides to quit by pressing T in Fig 3 Fig 5

20 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

The figure above displays the load capacity menu. This appears when the user selects W from the wash menu in Fig 3 Fig 6

After choosing the suitable load capacity of your wash, the wash menu in the figure above is displayed. Fig 8

If the user selects full wash F or wash W from the fig 7, the machine prompts the user to select if s/he wishes to soak the clothes. The soak menu above is displayed. Fig 9 (a)

21 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

If the user selects the rinse option R from the fig 7, the screen shot above is displayed.

Fig 9 (b)

If the user selects the rinse option S from the fig 7, the screen shot above is displayed. Fig 10

22 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

When the machine starts rinsing or spinning, the operation is recorded and stored in the view log and the image above is displayed. Fig 11

When the user selects soak option S from fig 8, the machine prompts the user to enter the time required for soaking. Fig 12

23 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

The user has to key in the time in a range of 1 to 60minutes. If the user keys in otherwise, an error message, as above, will be displayed. Fig 13 (a)

Fig 13 (b)

24 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

If the user selects the correct time in the range 1< t<60 or selects no soak from the soak option menu, the machine will prompt the user choose the temperature favorable for the wash and either the message above will be displayed. Fig 14 (a)

Fig 14 (b)

When the user selects the hot wash H or cold wash C either screen shots above will be displayed. Fig 15

25 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

When the machine starts washing, the operation is recorded and stored in the view log and the image above is displayed. Fig 16

The figure above displays the view log. This appears when the user selects V from the wash menu in Fig 3

26 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

ADDITIONAL FEATURES

27 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

ASSUMPTIONS Critical Evaluation


Benefits of the System
1. The system is very user friendly since user is given easy instructions an guidelines so as to ensure a smooth flow of the procedures involved 2. The user can view the options arrangement and select the program they would wish to take depending on their preference. 3. The user can also view previous washing machine operations
4. The system pays careful attention to data validation to ensure the user keys in the

correct input at any particular time and displays message to inform the user to enter the correct key if the input is wrong.

Shortcomings of the system


I. The user is restricted to run only one program at one particular time. This means that the user has to wait for one program at a time. The user is limited to the number of minutes in the soak option. The machine is limited to maximum 10 washes per day.

II. III.

CONCLUSIONS

28 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

WASHING MACHINE PROGRAM

GROUP ASSIGNMENT

REFERENCES
http://www.minich.com/education/wyo/stylesheets/pseudocode.htm http://www.nos.org/htm/basic2.htm

29 | P a g e

INTRODUCTION TO C PROGRAMMING

U.C.T.I

You might also like