
A miniature robot designed to mimic the
behavior of an ant is being tested to evaluate
the robot’s ability to avoid a chemical
repellant (the robot has a chemical sensor,
and a control loop that makes the robot
avoid moving in a direction that will result
in the sensor detecting a chemical
concentration above a certain limit). The x
and y positions of the robot are measured
with time, and the resulting data is saved to
a file called data.txt which contains 3
columns: the time of the measurement (in seconds), the x position (in cm), and the y position (in cm).
The first line of the file is a “header”: it has a single integer that specifies how many lines of data follow.
Write a C++ program called ant.cpp that reads files of this type (i.e., your program should work
with another, but similar, file!) and then does the following: it asks for an X and Y position, and then
prints to screen the time at which the ant robot was closest to this position. For example, if we wish
to know when the robot is closest to x = 200cm and y = 400cm (the red dot shown in the plot), your
program should produce:
Enter x & y position: 200 400
The smallest distance is 54.7068 cm, which occurs at 67.2 seconds.


Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images

- Traceback (most recent call last): File "C:/app.py", line 20, in main() File "C:/app.py", line 17, in main print_report() File "C:/app.py", line 12, in print_report print_id() File "C:/app.py", line 6, in print_id message = "Your id is:" + id num TypeError: must be str, not int Process finished with exit code 1 Given this stack trace above, on what line was the exception raised? O Line 17 O Line 12 O Line 6 O Line 20arrow_forwardC Sharp Random Number File writer and Reader Create an application that writes a series of random numbers to a file. Each random number should be in the range of 1 through 100. The application should let the user specify how many randome numbers the file will hold and should use a SaveFileDialog control to let the user specify the file's name and Location. Create another application that uses an OpenFileDialog control to let the user select the file that was created above. This application should read the numbers from the file, display the numbers in a ListBox control and display: the total of the numbers and the number of random numbers read from the file.arrow_forwardUsing python write a program that reads the data from the attached .csv file: Crude0il_20212022.csv. The file contains data regarding the price and volume of Crude Oil traded from August 2021 to July 2022. Once the data has been read, determine and display the following information: The highest and lowest Close/Last price for crude oil for the months of August 2021 through July 2022. Both prices must be displayed with 2 decimal places using an f-string. The number of trading days for the months of August 2021 through July 2022. The total trading volume for the months of August 2021 through July 2022 displayed with the thousands comma separated. The average daily trading volume for the months of August 2021 through July 2022 displayed with the thousands comma separated. Date Close/Last Volume Open High Low 8/2/2021 71.26 429120 73.91 73.95 70.55 8/3/2021 70.56 486786 71.52 71.96 69.19 8/4/2021 68.15 557749 70.32 70.81 67.85 8/5/2021 69.09 397456 68.06 69.35 67.61 8/6/2021 68.28 497049…arrow_forward
- Python onlyarrow_forwardIn PYTHON Write the code that will open and read the data from a file named Numbers.csv and write it to a file named justAsNumbers.csvarrow_forwardThis project involves generating a boarding pass ticket and storing it in a file. The application should take the passenger details as input. The details of the boarding pass are to be stored in a file. The details should include valid data such as: name, email, phone number, gender, age, boarding pass number, date, origin, destination, estimated time of arrival (ETA), departure time. The application should generate a boarding pass ticket using the boarding pass details. The generated ticket should contain the following information: Boarding Pass Number, Date, Origin, Destination, Estimated time of arrival (ETA), Departure Time Name, Email, Phone Number, Gender, Age Total Ticket Price The user will be required to enter their Name, Email, Phone Number, Gender, Age, Date, Destination, and Departure Time into the console or GUI. From the input the computer must generate the ETA and Ticket Price. The computer must generate the boarding pass number ensuring the number is unique. All…arrow_forward
- CODE SHOULD BE PYTHON:arrow_forwardit says Exercise09_13.java:5: error: class Location is public, should be declared in a file named Location.javapublic class Location {arrow_forwardA car dealer needs a program that will maintain an inventory of cars on the lot. There are three types of cars: sedans, station wagons, and SUVS. The model, year, color, and price need to be recorded for each car, plus any additional features for the different types of cars. The program must allow the dealer to: • Add a new car to the lot Remove a car from the lot • Correct any data that's been entered • Display information for any car The software developer decides to have these classes: Car, Inventory, Sedan, SUV, and StationWagon. Choose the correct answer after considering the following statements: 1. There are no inheritance relationships between these classes. 2. The Inventory class has-a list of Car objects. 3. The Sedan, StationWagon, and SUV classes are independent of each other. O Only 1 and 2 are true O Only 2 is true O Only 2 and 3 are true O Only 1 is true O Only 3 is truearrow_forward
- You are given 2 text files named drywet.txt and wetwet.txt. wetwet.txt data file refers to the probability of next day being a wet day if the current day is wet. drywet.txt data file refers to the probability of next day being a wet day if the current day is dry. NOTE: the data for the same location in wetwet.txt and drywet.txt will have the same line number. These files are in the format of: (excerpt from wetwet.txt)-97.58 26.02 0.76 0.75 0.77 0.74 0.80 0.86 0.94 0.97 0.89 0.77 0.74 0.77 -97.19 26.03 0.73 0.76 0.75 0.71 0.79 0.85 0.92 0.95 0.90 0.81 0.76 0.75 -98.75 26.35 0.74 0.76 0.76 0.73 0.67 0.84 0.83 0.85 0.80 0.71 0.71 0.76 … In each line, the first and second numbers represent the location’s longitude and latitude. The following 12 numbers represent the probability of the next day being a wet day of the month. For example, on the first line of the excerpt above 0.75 means that in February (4th column), there is a 75% of chance that the next day is a wet day if today is a wet…arrow_forwardThis is to be done using Visual Studio and the information input needs to be stored in an array of records.arrow_forwardA Stationery supplier “Adwaat Al Maktabiyah” needs a program to display sales as per regions and add the sales to the file called sales.txt. The files Personal Details.txt and Sales.txt have been provided. You may download and use them in your program. They are as shown below: PersonalDetails.txt Id First name Last Name Region E111 Alvin Jones East C121 Blake Kivell Central C253 Edda Jardine Central Sales.txt Rep_Id OrderDate Region Item Units UnitCost E111 1/6/2020 East Pencil 95 1.99 C121 1/23/2020 Central Binder 50 19.99 C253 2/9/2020 Central Pencil 36 4.99 Note: - Use structures in the coding and declare structure array as public as shown below. The question 7 doesn’t need arrays. Structure personaldetails Dim rid As String ' Employee id Dim fn As String 'First name Dim ln As String 'Last name Dim rn As String ' Region he belongs to End Structure Structure Regionalsales Dim id As String 'employee id Dim od As Date 'Order Date Dim region As String…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





