ONE. DataBase
Please use MySQL to Create DataBase like the language below
/*TabelName:inoutlist, Record the pass in and out of the storage*/
CREATE TABLE `inoutlist` (
/*Auto increment*/
`AutoID` int(11) NOT NULL auto_increment,
/*Time of pass in or out*/
`RecordTime` datetime NOT NULL default '0000-00-00 00:00:00',
/*ProductID*/
`ProductID` int(11) default NULL,
/*tag:in or out*/
`InOut` enum('out','in') default NULL,
/*the number of pass in or out*/
`Num` int(11) default NULL,
/*Primary Key*/
PRIMARY KEY (`AutoID`)
);
/*insert data to table inoutlist*/
insert into InOutList values (0,'2007-12-3 11:39:25',1,'out',3);
insert into InOutList values (0,'2007-12-4 10:39:25',2,'out',2);
insert into InOutList values (0,'2007-12-5 11:39:25',1,'out',5);
insert into InOutList values (0,'2007-12-5 11:39:26',2,'out',9);
insert into InOutList values (0,'2007-12-5 11:39:27',3,'out',3);
insert into InOutList values (0,'2007-12-5 09:39:25',2,'in',10);
insert into InOutList values (0,'2007-12-5 13:39:56',3,'in',5);
insert into InOutList values (0,'2007-12-6 09:39:30',2,'in',6);
insert into InOutList values (0,'2007-12-6 09:39:31',2,'in',8);
insert into InOutList values (0,'2007-12-6 09:39:32',1,'in',100);
insert into InOutList values (0,'2007-12-6 09:39:33',2,'in',50);
insert into InOutList values (0,'2007-12-6 09:39:34',3,'in',60);
insert into InOutList values (0,'2007-12-6 09:39:35',4,'in',10);
/*TableName:product, products in storage*/
CREATE TABLE `product` (
`ID` int(11) NOT NULL default '0',
`Name` varchar(255) default NULL,
PRIMARY KEY (`ID`)
) ;
/*insert data to table product*/
insert into product values (1,'Product1');
insert into product values (2,'Product2');
insert into product values (3,'Product3');
insert into product values (4,'Product4');
insert into product values (5,'Product5');
insert into product values (@a,'Product5')
Application running as the form below:
Table:InOutList:
┌───┬─────────┬─────┬───┬───┐
│AutoID│RecordTime │ProductID │InOut │ Num │
├───┼─────────┼─────┼───┼───┤
│ 1 │2007-12-3 11:39:25│ 1 │ out │ 3 │
├───┼─────────┼─────┼───┼───┤
│ 2 │2007-12-4 10:39:25│ 2 │ out │ 2 │
├───┼─────────┼─────┼───┼───┤
│ 3 │2007-12-5 11:39:25│ 1 │ out │ 5 │
├───┼─────────┼─────┼───┼───┤
│ 4 │2007-12-5 11:39:26│ 2 │ out │ 9 │
├───┼─────────┼─────┼───┼───┤
│ 5 │2007-12-5 11:39:27│ 3 │ out │ 3 │
├───┼─────────┼─────┼───┼───┤
│ 6 │2007-12-5 09:39:25│ 2 │ in │ 10 │
├───┼─────────┼─────┼───┼───┤
│ 7 │2007-12-5 13:39:56│ 3 │ in │ 5 │
├───┼─────────┼─────┼───┼───┤
│ 8 │2007-12-6 09:39:30│ 2 │ in │ 6 │
├───┼─────────┼─────┼───┼───┤
│ 9 │2007-12-6 09:39:31│ 2 │ in │ 8 │
├───┼─────────┼─────┼───┼───┤
│ 10 │2007-12-6 09:39:32│ 1 │ in │ 100 │
├───┼─────────┼─────┼───┼───┤
│ 11 │2007-12-6 09:39:33│ 2 │ in │ 50 │
├───┼─────────┼─────┼───┼───┤
│ 12 │2007-12-6 09:39:34│ 3 │ in │ 60 │
├───┼─────────┼─────┼───┼───┤
│ 13 │2007-12-6 09:39:35│ 4 │ in │ 10 │
└───┴─────────┴─────┴───┴───┘
Table:Product:
┌───┬─────┐
│ ID │Name │
├───┼─────┤
│ 1 │Product1 │
├───┼─────┤
│ 2 │Product2 │
├───┼─────┤
│ 3 │Product3 │
├───┼─────┤
│ 4 │Product4 │
├───┼─────┤
│ 5 │Product5 │
└───┴─────┘
Demand: write out the SQL sentence which will run as the form below without changing of the original table and data
┌───┬────┬───┬───┬───┐
│ ID │Name │ In │ Out │ Save │
├───┼────┼───┼───┼───┤
│ 1 │Product1│ 100 │ 8 │ 92 │
├───┼────┼───┼───┼───┤
│ 2 │Product2│ 74 │ 11 │ 63 │
├───┼────┼───┼───┼───┤
│ 3 │Product3│ 65 │ 3 │ 62 │
├───┼────┼───┼───┼───┤
│ 4 │Product4│ 10 │ 0 │ 10 │
├───┼────┼───┼───┼───┤
│ 5 │Product5│ 0 │ 0 │ 0 │
└───┴────┴───┴───┴───┘
explanation: ID - ProductID
Name - ProductName
In - accumulative total of the Product pass in storage
Out - accumulative total of the Product pass out storage
Save - stocks of the product
TWO. Arithmetic
Please complete the function according to the document demand
public class ncsmsoft {
public static void main(String[] args) {
//test result
System.out.print(findSum(35,"12,60,8,-8,99,15,35,17,18"));
}
/*==============================================
function:findSum
creator:(name)
create time:(time)
updator name:(name)
update time:(time)
version number:1.0
description:find all the possible assembled from the character string that the sum of which
equal to the appoint value
input parameter:Double he //appoint value
String shuzu //a character string divide by comma
output parameter:result
output format:for example "12+8+15;35;17+18"
testor :(name)
=================================================*/
private static String findSum(double he,String shuzu){
StringBuffer result=new StringBuffer();
//Please input your program here without changing of the other code
if(he==0)
return(1);
else if(he<0||s>0&&qures(shuzu,"")==1)
return(0);
else if(findSum(he-shuzu,shuzu)==1)
{
System.out.print();
}
else
return(findSum(he,shuzu));
}
//return your result as the format "12+8+15;35;17+18"
return result.toString();
}
}
THREE. JavaScript
1.Please use javascript to create a class of right-Click-Menu that base on the web.
2.make this class extend to a new class that can expand a second menu.
3.make this class extend to a new class that can expand a limitless menu.
explanation:for example, like the windows, when we click the right button of the mouse on the desk, that will pop-up a menu, that is what we call the right-click-menu. watch carefully, our right-click-menu is base on the web but not the others, also not like the fixed navigation.