A large number of helium balloons have been set up as part of a carnival game. Players shoot a pellet gun into the balloons and earn a point for every balloon they pop. Each balloon is spherical and is tied to a string at the bottom. Each string is taped by giving a three-dimensional location, p, for the end of the barrel and a vector, v, describing the direction the barrel is pointing. a table top at a particular location. Gunshots are described We assume that the pellet is very small and travels in a perfectly straight line when fired. It pops any balloon it passes through. The strings tied to the balloons are so thin that they are never hit by the pellet. Input Input contains up to 100 test cases. Each test case begins with an integer, 1

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Use c# for the following case 

A large number of helium balloons have been set up as part of a carnival game. Players shoot a pellet gun
into the balloons and earn a point for every balloon they pop. Each balloon is spherical and is tied to a
string at the bottom. Each string is taped
by giving a three-dimensional location, p, for the end of the barrel and a vector, v, describing the
direction the barrel is pointing.
a table top at a particular location. Gunshots are described
We assume that the pellet is very small and travels in a perfectly straight line when fired. It pops any
balloon it passes through. The strings tied to the balloons are so thin that they are never hit by the pellet.
Input
Input contains up to 100 test cases. Each test case begins with an integer, 1 <n< 50, giving the number
of balloons. This is followed by n lines, each containing four space-separated real numbers: the radius
of the balloon (0 <r< 10), the length of string it's tied to (0 <s< 10), and the x, y location on the
table top where the string is taped down (-10 < x, y < 10).
The balloon descriptions are followed by a line containing an integer 1 < m < 10. The next m lines each
contain a gunshot description, which has six space-separated real numbers, the x, y, z location for p
(where z is the height above the table) and the x, y and z coordinates for v. All shot coordinates are in
the range [-10, 10].
You can be assured that the tip of the barrel is not inside any balloon and that no balloons intersect.
Also, no string from one balloon touches any other balloon and the direction vector for the gun always
has positive length. All real numbers have at most 10 digits after the decimal point. The end of all test
cases is marked by a value of zero for n.
Output
For each shot in a test case, output the number of points earned by that shot.
Sample Input 1
Sample Output 1
2.
1.0 4.0 0.0 0.0
1.5 3.5 0.0 8.0
1.5 3.5 0.0 -8.0
1
1.5 3.5 8.0 0.0
1.5 3.5 -8.0 0.0
1.0 - 10.0 4.5 0 1 0
0.8 -10.0 5.0 0 10
- 10.0 0.0 5.0 10 0
1.0 5.0 0.0 10.0
1.0 3.0 0.0 - 10.0
0.0 0.0 5.0 0.0 1.0 0. 1
Transcribed Image Text:A large number of helium balloons have been set up as part of a carnival game. Players shoot a pellet gun into the balloons and earn a point for every balloon they pop. Each balloon is spherical and is tied to a string at the bottom. Each string is taped by giving a three-dimensional location, p, for the end of the barrel and a vector, v, describing the direction the barrel is pointing. a table top at a particular location. Gunshots are described We assume that the pellet is very small and travels in a perfectly straight line when fired. It pops any balloon it passes through. The strings tied to the balloons are so thin that they are never hit by the pellet. Input Input contains up to 100 test cases. Each test case begins with an integer, 1 <n< 50, giving the number of balloons. This is followed by n lines, each containing four space-separated real numbers: the radius of the balloon (0 <r< 10), the length of string it's tied to (0 <s< 10), and the x, y location on the table top where the string is taped down (-10 < x, y < 10). The balloon descriptions are followed by a line containing an integer 1 < m < 10. The next m lines each contain a gunshot description, which has six space-separated real numbers, the x, y, z location for p (where z is the height above the table) and the x, y and z coordinates for v. All shot coordinates are in the range [-10, 10]. You can be assured that the tip of the barrel is not inside any balloon and that no balloons intersect. Also, no string from one balloon touches any other balloon and the direction vector for the gun always has positive length. All real numbers have at most 10 digits after the decimal point. The end of all test cases is marked by a value of zero for n. Output For each shot in a test case, output the number of points earned by that shot. Sample Input 1 Sample Output 1 2. 1.0 4.0 0.0 0.0 1.5 3.5 0.0 8.0 1.5 3.5 0.0 -8.0 1 1.5 3.5 8.0 0.0 1.5 3.5 -8.0 0.0 1.0 - 10.0 4.5 0 1 0 0.8 -10.0 5.0 0 10 - 10.0 0.0 5.0 10 0 1.0 5.0 0.0 10.0 1.0 3.0 0.0 - 10.0 0.0 0.0 5.0 0.0 1.0 0. 1
Expert Solution
steps

Step by step

Solved in 4 steps with 35 images

Blurred answer
Knowledge Booster
Fundamentals of Multithreaded Algorithms
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education