1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AleksAgata [21]
2 years ago
6

Write an if-else statement for the following: If user_tickets is less than 5, assign 1 to num_tickets. Else, assign user_tickets

to num_tickets
Computers and Technology
1 answer:
Genrish500 [490]2 years ago
7 0

Solution :

function tickets(user_tickets){

var num_tickets;

if (user_tickets < 5) {

num_tickets = 1;

return ('num_tickets: '+ num_tickets);

}

else {

num_tickets = user_tickets;

 return('num_tickets: '+ num_tickets);

}

}

// Testing the tickets function

// With user_tickets = 3, 5, 8, and 1

console.log(tickets(3));

console.log(tickets(5));

console.log(tickets(8));

console.log(tickets(1));

You might be interested in
Write the program to solve quadratic equations, but if the discriminant is negative, output
Firdavs [7]

Answer:

PROGRAM  QuadraticEquation Solver

  IMPLICIT  NONE

REAL :: a, b, c ;

  REA :: d ;

  REAL  :: root1, root2 ;

//read in the coefficients a, b and c

  READ(*,*)    a, b, c  

  WRITE(*,*)   'a = ', a

  WRITE(*,*)   'b = ', b

  WRITE(*,*)    'c = ', c

  WRITE(*,*)

// computing the square root of discriminant d

  d = b*b - 4.0*a*c

  IF (d >= 0.0) THEN              //checking if it is solvable?

     d     = SQRT(d)

     root1 = (-b + d)/(2.0*a)     // first root

     root2 = (-b - d)/(2.0*a)     // second root

     WRITE(*,*)  'Roots are ', root1, ' and ', root2

  ELSE                            //complex roots

     WRITE(*,*)  'There is no real roots!'

     WRITE(*,*)  'Discriminant = ', d

  END IF

END PROGRAM  QuadraticEquationSolver

8 0
3 years ago
Which is a network of devices built around a person, typically within 10 meters of range?
11111nata11111 [884]

Answer:

A LAN

Explanation:

A LAN, or a Local Area Network, is a network of devices typically within 10 meters of range regardless of what it is built around.

6 0
3 years ago
How did sea lamprey get here
maw [93]
Reproduction. One layed some eggs then another and another and then BOOM here they are.
6 0
2 years ago
Describe the conventional method of data processing​
andreyandreev [35.5K]

Answer:

The data processing is broadly divided into 6 basic steps as Data collection, storage of data, Sorting of data, Processing of data, Data analysis, Data presentation, and conclusions. There are mainly three methods used to process that are Manual, Mechanical, and Electronic.

4 0
2 years ago
Read 2 more answers
Lesser-known ideas and interpretations of common knowledge need to be documented. true or false.
Tresset [83]
False. As it is common knowledge, it is unnecessary for it to be documented.
7 0
2 years ago
Other questions:
  • What benefit does internet have​
    11·1 answer
  • What does the hard disk drive do?
    9·2 answers
  • Which computer network component allows data transfers from one computer to another through a telephone line?
    11·2 answers
  • Var faceS = 100; var mouthS = 30; ellipse(200, 200, faceS, faceS); ellipse(200, 220, mouthS, mouthS); How wide is the second ell
    12·1 answer
  • The next four octal numbers after 36 is:________.
    10·1 answer
  • The right headlight does not function on either high or low beam. Technician A says this could be caused by an open ground on th
    12·1 answer
  • Suppose that the following elements are added in the specified order to an empty binary search tree: Kirk, Spock, Scotty, McCoy,
    12·1 answer
  • Which part of project management considers if employees will work at home or in the office?
    10·2 answers
  • 25 points
    8·2 answers
  • open your browser and enter the address of this ftp site in the address box: ftp.cengage. if your browser supports ftp, a logon
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!