answer.
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
Readme
29 days ago
7

OCR Land is a theme park aimed at children and adults. Entrance tickets are sold online. An adult ticket to OCR Land costs £19.9

9, with a child ticket costing £8.99. A booking fee of £2.50 is added to all orders. One ride in OCR Land has a minimum height of 140 cm to ride alone or 120 cm to ride with an adult. Create an algorithm that: • asks the user to input the height of the rider, in centimetres • if needed, asks if they are riding with an adult • outputs whether or not they are allowed to ride • repeats this process until 8 people have been allowed to ride
Computers and Technology
1 answer:
Rzqust [894]29 days ago
5 0

Answer:

count = 0

while count!= 8:

height = float(input("Enter the height of the rider: "))

if height >= 140:

print("You may ride")

count += 1

else:

if height >= 120:

answer = input("Is the rider accompanied by an adult (yes/no): ")

if answer == "yes":

print("You may ride")

count += 1

else:

print("You are not permitted to ride")

else:

print("You are not permitted to ride")

Explanation:

Begin with a count of zero, which will track the number of riders allowed. Use a while loop that continues until the count reaches 8. During each iteration, request the user's height. If the height is 140 cm or taller, display "You may ride" and increment the count. If the height is 120 cm or more, check if the rider is with an adult. If not, show the message "You are not permitted to ride"; otherwise, allow the ride and increase the count. If the height is below 120 cm, deny the ride.

You might be interested in
When adopting and implementing a Software as a Service (SaaS) platform such as Salesforce for your business, which responsibilit
Amiraneli [921]

Answer:A SaaS platform entrusts the client company with the duty of providing applications online, as well as creating, hosting, and maintaining the product.

Explanation:

An example of Software as a Service (SaaS) is Salesforce, which provides business applications over the internet.

Software as a Service (SaaS) utilizes cloud technology to host web-based applications, allowing access to users via the internet without necessitating installation or maintenance of the application software. Users simply need an internet connection and a web browser to utilize the service.

8 0
18 days ago
The president of the company wants a list of all orders ever taken. He wants to see the customer name, the last name of the empl
zubka84 [942]

Response:

refer to the explanation

Clarification:

Examine the SQL statement shown below:

SELECT c.CustomerName, e.LastName, s.ShipperName, p.ProductName, o.Quantity, od.OrderDate

FROM

Customers c, Employees e, Shippers s, Orders o, OrderDetails od, Products p

WHERE c.customerID = o.customerID AND

e.employeeID = o.employeeID AND

o.orderID = od.orderID AND

od.shipperID = s.shipperID AND

od.productID = p.productID;

6 0
26 days ago
Write an application that throws and catches an ArithmeticException when you attempt to take the square root of a negative value
Harlamova29_29 [932]

The code relevant to the problem in question:

import java.util.Scanner;

public class Test {

   public static void main(String[] args) {

       double number;

       double squareRootOfNumber;

       String userInput = null;

       Scanner scanner = new Scanner(System.in);

       System.out.println("Please enter a number: ");

       userInput = scanner.next();

       number = Double.parseDouble(userInput);

       squareRootOfNumber = Math.sqrt(number);

       if (number < 0) {

           throw new ArithmeticException("Cannot compute the square root of a negative number");

       }

       System.out.format("The square root of the entered number is %.2f %n", squareRootOfNumber);

   }

}

The program will output:

Please enter a number:

-90

Exception in thread "main" java.lang.ArithmeticException: Cannot compute the square root of a negative number at com..ans.Test.main(Test.java:18)

Explanation:

The standard Java library function java.lang.Math.sqrt does not throw an ArithmeticException for negative arguments, hence there’s no need to enclose your code in a try/catch block.

Instead, we manually trigger ArithmeticException using the throw keyword:

throw new ArithmeticException("Cannot compute the square root of a negative number");

3 0
1 month ago
Write a method, isEmailAddress, that is passed a String argument. It returns true or false depending on whether the argument has
Amiraneli [921]

Answer:

//This method takes a parameter called myString of type String

public static boolean isEmailAddress (String myString){

//verifying if the @ character exists in the string

if (myString.indexOf("@")!= -1) {

  //ensuring that only a single instance of @ appears in the string

   if (myString.indexOf("@") == myString.lastIndexOf("@")) {

   //confirming absence of space characters

  if (myString.indexOf(" ") == -1) {

    //checking for the absence of newline characters in the string

    if (myString.indexOf("\n") == -1) {

      //checking for absence of tab characters in the string

      if (myString.indexOf("\t") == -1) {

          return true;

      }

    }

  }

}

}

 return false;

}

Explanation:

The method takes a string presumed to be an email address and verifies whether it is valid, returning true if it is valid and false otherwise. The method checks the following conditions:

->The presence of the "@" character

->Only one occurrence of "@" exists in the string

->No spaces present

->No newline characters present

->No tab characters present

Returning true only if all these conditions are met.

8 0
11 days ago
Assume that a function named swapdoubles has been defined and is available for use in this exercise: that function receives two
Natasha_Volkova [897]
The provided C++ code is designed to sort three double variables: void sort3(double &a, double &b, double &c). The logic within functions attempts to ensure that these values are ordered correctly, implementing swaps accordingly.
6 0
18 days ago
Other questions:
  • Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
    5·1 answer
  • Write a for loop to print all NUM_VALS elements of array hourlyTemp. Separate elements with a comma and space. Ex: If hourlyTemp
    6·1 answer
  • Until 2015, each new Roblox user automatically had one friend. What was he called?
    12·2 answers
  • Recall that with the CSMA/CD protocol, the adapter waits K. 512 bit times after a collision, where K is drawn randomly. a. For f
    5·1 answer
  • Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 the output is
    5·1 answer
  • Factoring of integers. Write a python program that asks the user for an integer and then prints out all its factors. For example
    13·1 answer
  • This question refers to a standard deck of playing cards. If you are unfamiliar with playing cards, there is an explanation in P
    10·2 answers
  • Redo Programming Exercise 16 of Chapter 4 so that all the named constants are defined in a namespace royaltyRates. PLEASE DONT F
    14·1 answer
  • What problem does the DNS solve? How does the DNS help the world wide web scale so that billions of users can access billions of
    11·1 answer
  • An application specifies a requirement of 200 GB to host a database and other files. It also specifies that the storage environm
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!