Free Response Question 1: Car Parking Robot
Explore how to design a car parking robot function that parks cars in a lot using Java iteration concepts. Learn to use loops to fill rows and manage space between cars accurately. This lesson helps you apply programming fundamentals to solve a practical problem.
We'll cover the following...
Background
Today, robots are used to perform complex tasks in no time with more accuracy and efficiency than human beings. Industrial robots have replaced humans to carry out repetitive tasks, e.g., assembling parts of a car. You might have seen mobile robots, e.g., aerial photography drones used to capture an aerial view of a special event. There’s a never-ending list.
In this exercise, you have to design a robot. Sounds fascinating, right? Think of a car parking lot. You need to design a car parking robot that manages the car parking area.
Problem statement
Intent: Design a robot() function to park a certain number of cars in a car parking lot.
- Declare the header of
robot()correctly. It takes three parameters:- Length of the car parking lot
- Width of the car parking lot
- Number of cars to be parked
In what manner do we need to park cars? Let’s answer this question. If we have a car parking lot measuring meters wide and ...