How to accept numerical data value/ program management
How to accept numerical data value:-
-In javascript accept numerical data using parseInt() method
var a,b,c;
a=parseInt(prompt("Enter any number"));
b=parseInt(prompt("Enter any number"));
c= a + b;
document.write("The value of c is " + c);
Program management:-
- All types of programming langauge is used to two types of method for managing the program
1) condition management
2)flow management
1) condition management:-
if-else,else-if,switch case
2) flow management:-
-It is called looping statement
while loop, do while loop,for loop
- if-else use only single condition
var a,b,c;
a=parseInt(prompt("Enter any number"));
b=parseInt(prompt("Enter any number"));
c= a + b;
document.write("The value of c is " + c);
Else if statement:-
-else-if is used to check multiple conditions in a program
Q-input percent from the user and check the fallowing condtion-
percent > 60 then display 'A' grade
percent > 50 and < 60 'B' grade
percent > 40 and <30 "c" grade otherwise fail\
Task:-
1) write a program to generate fallowing result:
input fallowing information from the user
name
city
branch
subject
M1
M2
M3
M4
M5
Logic:
1) calculate total if all subject marks greater then 40
2) If total is generated then check the fallowing condition-
total>250 -A grade and provide 100 grace mark in total
total >150 and < 250 -B grade and provide 50 grace mark in total otherwise fail
3)print all the student information on computer screen only if total generated
Task2:
input amount from the user and calculate 18% GST of given amount and display total amount
result- amount -5,000
Gst 18% -690
total amount -5,690
Task3:-
input fallowing information from the user
product name
cost
quantity
logic:
1) calculate total amount
2) check the fallowing condition
total >5,000 then provide 10% discount of given total and display final amount
total >2,000 and <5,000 then provide 5% discount of given total and display final amount
3) if user can enter 0 quantity then total can't generated and display massage "please input valid quantity " in alert box
Task4:-
create any ideas excluding task
Comments
Post a Comment