bonjour,
j'ai un exercices, mais l'énoncé est en anglais et je ne sais pas du tout comment faire vous pourriez m'aider?
voici l'énoncé
Using this template, write code that will log a customer in. For the convenience of their customers, SofaSpend have simplified the log-in process, so that the system prompts them to enter their password only (instead of asking for both user name and password as is generally the case). Therefore, your code will just need to request a password from the user and check it against the passwords in the password array. If a match is not found, the system simply asks for the password again, and continues to do so until a match is found. Once a match has been found, a welcome message is displayed, which includes the customer code and should look like this:
Welcome, Customer il-77. Ready to start shopping?
Test your program using the password onlyme.
NOTE: You might find it useful for the later parts of this question if you store the customer’s index number, the position he or she occupies in the customer arrays. We have provided a variable you can use for this purpose
et voici le template, le code de début
merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 <HTML> <HEAD> M150 TMAO3 Question 2 <TITLE>SOFASPEND - IN THE BEST POSSIBLE TASTE!</TITLE> <SCRIPT language="JavaScript" type="text/javascript"> // These are arrays containing customer data var customerCodes = ['lt-17', 'gw-3', 'lg-9', 'il-77', 'fy-32']; var customerPasswords = ['password', 'bluesky', 'dr45gr6', 'onlyme', 'lothlorien']; // These are arrays containing product data var productCodes = ['a-23-009', 'k-246-07', 'd-555-01', 'n-87-012', 'u-521-08', 't-99-002']; var productDescriptions = ['Superslurry electric blender', 'Apple - iPod (second-hand)', 'CoziNap nylon duvet tog 2', 'Headbanger mini hi-fi 20W', 'MagiBoot shoe cleaning kit', 'The PushmiPulu lawnmower']; var productPrices = [45, 50, 15, 25, 75, 7, 60]; var productStock = [200, 0, 2, 500, 500, 15]; // These are useful variables var customerIndex; </SCRIPT> </HEAD> <BODY> </BODY> </HTML>
Partager