Solution:
<html> <head> <title>Student admission form: Student ID: Your VU ID</title>
<script language="javascript" type="text/javascript">
function checkForm(){
if (document.regForm.one.value.length < 1){
alert("Empty Form field...! Please fill.");
return false;
}
if (document.regForm.two.value.length < 1){
alert("Empty Form field...! Please fill.");
return false;
}
if (document.regForm.three.value.length < 1){
alert("Empty Form field...! Please fill.");
return false;
}
if (document.regForm.four.value.length < 1){
alert("Empty Form field...! Please fill.");
return false;
}
return true;
}
</script>
</head>
<body background="C:\WINDOWS\Web\Wallpaper\Crystal.jpg" >
<form name="regForm" action="http://www.vu.edu.pk" method="post" onSubmit="return checkForm()">
<table border="0" align="center">
<tr><td align="center" bgcolor="sky blue" width="800" colspan="text">
<font color="white"><b>ADMISSION FORM</b></font></td></tr></table>
<table border="1" bordercolor="sky blue" align="center" bgcolor="white">
<tr><td colspan="2" align="left" bgcolor="sky blue" width="800">
<font color="white"><b>BIO-DATA</b></font></td></tr>
<tr><td align="left" width="30%"><b>Candidate's Name : </b></td>
<td width="70%">
<input type="text" align="left" name="one" size="20" maxlength="25"><b><font color="red">
Max. character limit is 25 </font></b></td></tr>
<tr><td align="left" width="30%"><b>Father's Name : </b></td>
<td width="70%"><input type="text" align="left" name="two" size="20" maxlength="25"><b><font color="red">
Max. character limit is 25 </font></b></td></tr>
<tr><td valign="top" width="30%"><b>Postal-Address : </b></td>
<td width="70%"><textarea name="three" cols="30" rows="3"></textarea><b><font color="red"></td></tr>
<tr><td align="left" width="30%"><b>Upload Your CV : </b></td>
<td width="70%"><input type="file" name="four" value="Browse" enctype="multipart"></td></tr>
<tr><td colspan="2" align="left" bgcolor="sky blue" width="800">
<b><font color="white">EDUCATION</b></font></td></tr>
<tr><td align="left" width="30%"><b>Highest Education : </b></td><td width="70%">
<select name="H.E">
<option selected> --- Click to Select --- </option>
<option>BBA</option>
<option>B.A</option>
<option>BS(IT)</option>
<option>BCS</option>
<option>MBA</option>
<option>MCS</option>
</select></td></tr>
<tr><td valign="top" width="30%"><b>GRADE : </b></td>
<td width="70%"><input type="radio" name="radio">A+<br>
<input type="radio" name="radio">A<br>
<input type="radio" name="radio">B+<br>
<input type="radio" name="radio">B<br>
<input type="radio" name="radio">C+<br>
<input type="radio" name="radio">C<br>
</td></tr>
<tr><td colspan="2" align="left" bgcolor="sky blue" width="800">
<font color="white"><b>DEGREE PROGRAMME</b></font></td></tr>
<tr><td width="30%"><b>Program Applied for: </b></td><td width="70%">
<select name="applied">
<option selected> --- Click to Select --- </option>
<option>MS(CS)</option>
<option>MS(BA)</option>
<option>MCS</option>
<option>MBA</option>
<option>BCS</option>
<option>BBA</option>
</select></td></tr>
<tr><td valign="top" width="30%"><b>Session Applied for : </b></td>
<td width="70%">
<input type="checkbox" name="check">Morning<br>
<input type="checkbox" name="check">Afternoon<br>
<input type="checkbox" name="check">Evening<br>
</td></tr>
<tr><td align="left" width="30%"></td>
<td width="70%"><input type="submit" name="regForm" value="Submit" >
<input type="reset"></td></tr>
<table border="0" align="center">
<tr><td align="center" bgcolor="sky blue" width="800" colspan="text">
</table> </form> </body> </html>
Another solution
<HTML>
<HEAD>
<TITLE>New User Registartion form</TITLE>
<SCRIPT>
function checkForm(){
if (document.login.user.value.length < 1) {
window.alert('Empty fields Found!! Please Fill empty fields');
}
else if (document.login.user.value.length > 1) {
window.alert('All Fields are entered');
}
}
function checkForm(){
if (document.login.password.value.length < 1) {
window.alert('Empty fields Found!! Please Fill empty fields');
}
else if (document.login.password.value.length > 1) {
window.alert('All Fields are entered');
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="login" method="post" action=loginScriptURL>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<th align ="left"rowspan="2"><img src="http://icwdic.webcontent-m1.com/m1/res/resource/contest_logos/vu_logo.PNG" width="141" height="88" /></th><td align ="right"><font color ="red"><b>Already a user Login here !!!</b></font>
</tr>
<tr>
<td align="right">User Name<input type="text" name="user" size="20">
password <input type="password" name="password" size="10" maxlength="7">
<INPUT type="submit" name="login" value="login"
onMouseOver="checkForm()">
</TD></TR></TABLE><table border="1" bordercolor="lightblue"cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" bgcolor="Darkblue"><font color="white"><b>Personal Information</b></font></td>
</tr></table></FORM>
<FORM name="submit" method="post" action=submitScriptURL>
<table border="1" bordercolor="lightblue"cellpadding="0" cellspacing="0" width="100%">
<tr><td width="30%">Name</td><td><input type="text" name="user" size="20"></td></tr>
<tr><td width="30%">Father's name</td><td><input type="text" name="fathername" size="20"></td></tr>
<tr><td width="30%">Address</td><td><textarea name="message" cols="20" rows="2"></textarea></td></tr>
<tr><td width="30%">Upload picture</td><td><input name="fileupload" id="fileupload" type="file">
</td></tr>
</table>
<table border="1" bordercolor="lightblue"cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" bgcolor="Darkblue"><font color="white"><b>Account Information</b></font></td>
</tr></table>
<table border="1" bordercolor="lightblue"cellpadding="0" cellspacing="0" width="100%">
<tr><td width="30%">Email</td><td><input type="text" name="email" size="20"></td></tr>
<tr><td width="30%">Password</td><td><input type="password" name="password" size="20" maxlength="7"><b><font color="red">7 characters only*</font></b></td></tr>
<tr><td width="30%">Confirm password</td><td><input type="password" name="cpassword" size="20" maxlength="7"><b><font color="red">7 characters only*</font></b></td></tr>
</table>
<table border="1" bordercolor="lightblue"cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" bgcolor="Darkblue"><font color="white"><b>Qualification</b></font></td>
</tr></table>
<table border="1" bordercolor="lightblue"cellpadding="0" cellspacing="0" width="100%">
<tr><td width="30%">Highest Degree</td><td><select name"degree"><option value"select" selected> ---Select---
<option value"Phd">Phd
<option value"Masters degree">Masters degree
<option value"Bachelors Degree">Bachelors Degree
<option value"Intermediate">Intermediate
</select></td></tr>
<tr><td width="30%">College/University</td><td><input type="text" name="cvname" size="20"></td></tr>
<tr><td width="30%">Status</td><td><input type="radio" name="complete" value="complete" checked>Completed
<input type="radio" name="Continued" value="Continued">Continued</td></tr>
<tr><td width="30%">Degrees achieved</td><td><input type="checkbox" value="PHD">PHD<br>
<input type="checkbox" value="MPhil">MPhil<br>
<input type="checkbox" value="Masters">Masters<br>
<input type="checkbox" value="Bachelors">Bachelors<br>
<input type="checkbox" value="Intermediate">Intermediate<br>
<input type="checkbox" value="Matriculation">Matriculation </td></tr>
<tr><td width="30%"></td><td><input type="submit"name="reg" value="Register"><input type="reset" value="Reset"></td></tr>
</table>
<br>
<table border="1" bordercolor="lightblue"cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" bgcolor="Darkblue" align="center"><font color="white"><b>2010 All Rights reserved</b></font></td>
Assignment No. 02
SEMESTER Fall 2010
CS301- Data Structure
SEMESTER Fall 2010
CS301- Data Structure
Question:
Write a program in c++ that takes an infix expression from user through command line argument and convert it into a postfix expression. You are required to use the stack data structure for the implementation of this task.
#include
#include
#include
#include
class expression
{
private:
char infix[100];
char stack[200];
int top;
int r;
char postfix[100];
public:
void convert();
int input_p(char);
int stack_p(char);
int rank(char);
};
int expression::input_p(char c)
{
if(c==’+’ || c==’-')
return 1;
else if(c==’*’ || c==’/')
return 3;
else if(c==’^')
return 6;
else if(isalpha(c)!=0)
return 7;
else if(c==’(‘)
return 9;
else if(c==’)')
return 0;
else
{
cout<<”Invalid expression ::input error\n”; exit(0); } } int expression::stack_p(char c) { if(c==’+’ || c==’-') return 2; else if(c==’*’ || c==’/') return 4; else if(c==’^') return 5; else if(isalpha(c)!=0) return 8; else if(c==’(‘) return 0; else { cout<<”Invalid expression ::stack error\n”; exit(0); } } int expression::rank(char c) { if(c==’+’ || c==’-') return -1; else if(c==’*’ || c==’/') return -1; else if(c==’^') return -1; else if(isalpha(c)!=0) return 1; else { cout<<”Invalid expression ::in rank\n”; exit(0); } } void expression::convert() { cout<<”\n*************************************************\n” <<”This program converts the given infix expression\n” <<”in to postfix form” <<”\n*************************************************\n”; cout<<”Enter an infix expression ::\n”; cin>>infix;
int l=strlen(infix);
infix[l]=’)';
infix[l+1]=”;
//Convertion starts
top=1;
stack[top]=’(‘;
r=0;
int x=-1;
int i=0;
char next=infix[i];
while(next!=”)
{
//Pop all the elements to outputin stack which have higher precedence
while( input_p(next) < stack_p(stack[top]) )
{
if(top<1)
{
cout<<”invalid expression ::stack error\n”;
exit(0);
}
postfix[++x]=stack[top];
top–;
r=r+rank(postfix[x]);
if(r<1)
{
cout<<”Invalid expression ::r<1\n”;
exit(0);
}
}
if(input_p( next ) != stack_p( stack[top]))
stack[++top]=next;
else
top–;
i++;
next=infix[i];
}
postfix[++x]=”;
if(r!=1 || top!=0)
{
cout<<”Invalid expression ::error in rank or stack\n”;
exit(0);
}
cout<<”\n\nThe corresponding postfix expression is ::\n”;
cout<
}
int main()
{
expression obj;
obj.convert();
return 0;
}
/************************************************************************
===========================================================================
Object Oriented Programming (CS304)
Assignment No.2
Assignment:
In Assignment No.1 you developed Object Oriented Model for Library Management System, now you have to give its practical prototype in c++ mean you have to provide the solution of your first assignment and have to implement it in the form of classes in c++ also note that you don’t have to give actual implementation in c++ but simple stereotype (sketch) in the form of c++ code mentioning class names their parameters and functions with access specifiers you also have to show the relationship between classes in the form of inheritance mentioning the name of class/classes from which they have been derived in proper c++ syntax.
class Library
{
Private:
char name[50];
char interface[30];
double space[30];
public:
void store detail of data();
void add();
void Search();
void Return();
void Borrow();
}
class Administrator : public Library
{
Private:
Char name[50];
Char Gender[50];
Char id[50];
Char address[50];
Public:
void Login();
void Logoff();
void search();
void Add();
void Borrow();
void return();
}
class staff : public library
{
Private:
Char name[50];
Char Gender[50];
Char id[50];
Char address[50];
Public:
void Login();
void Logoff();
void search();
void Add();
void Borrow();
void return();
}
class student : public library
{
Private:
Char name[50];
Char Gender[50];
Char id[50];
Char address[50];
Public:
void Login();
void Logoff();
void search();
void Add();
void Borrow();
void return();
}
This comment has been removed by the author.
ReplyDeleteThankx Bro...
ReplyDelete