Question

Code in Java Please Write a program to manage birds sitting on a telephone wire. Each bird has a name, weight, size, and position. The wire is 200 feet long, and birds only sit on whole number points on the wire - that is, a bird can sit at 122, but not 121.8 or 122.5. The size of a bird determines how much space it takes - a bird of size 5 sitting at 110 means that bird occupies points 108, 109, 110, 111, and 112. Bird sizes are always odd integers. You will define a class Bird which keeps track of each bird's name, size, weight, and position (1 string, 3 integers). You will manage birds on the wire as a doubly-linked list. The minimum bird size is 1, and the maximum size is 9. The minimum weight is 1, and the maximum weight is 50. You will prompt the user with the options to add a bird, delete a bird (by name), calculate the total weight (If the total weight exceeds 300, then print a warning message for the user), print out the birds (name, weight, size, position) in order on the wire, print the birds backwards, read inputs from a file called bird_data.txt, or to end the program. bird_data.txt will have 3 types of lines: - a bird_name bird_weight bird_size bird_position - d bird_name - e These should act the same as if the user was entering things from the keyboard. I.e. "a …" adds a bird to the doubly-linked list. "d …" deletes a bird from the doubly-linked list. "e" ends reading from the file but does not end the overall menu. If a command from the file causes an error, print the error message on the console. So a sample file might have these lines: a eagle 20 7 25 a robin 5 1 50 d eagle e There will still be a user menu for the user to do things manually (as in Program 5a), but the menu will include an option to read from the file and an option to print birds in reverse order. For this program, the Bird class should be in Program6aBird and the main program should be in Program6a.

          Code in Java Please Write a program to manage birds sitting on a telephone wire. Each bird has a name, weight, size, and position. The wire is 200 feet long, and birds only sit on whole number points on the wire - that is, a bird can sit at 122, but not 121.8 or 122.5. The size of a bird determines how much space it takes - a bird of size 5 sitting at 110 means that bird occupies points 108, 109, 110, 111, and 112. Bird sizes are always odd integers.
    
    You will define a class Bird which keeps track of each bird's name, size, weight, and position (1 string, 3 integers). You will manage birds on the wire as a doubly-linked list. The minimum bird size is 1, and the maximum size is 9. The minimum weight is 1, and the maximum weight is 50.
    
    You will prompt the user with the options to add a bird, delete a bird (by name), calculate the total weight (If the total weight exceeds 300, then print a warning message for the user), print out the birds (name, weight, size, position) in order on the wire, print the birds backwards, read inputs from a file called bird_data.txt, or to end the program.
    
    bird_data.txt will have 3 types of lines:
    - a bird_name bird_weight bird_size bird_position
    - d bird_name
    - e
    
    These should act the same as if the user was entering things from the keyboard. I.e. "a …" adds a bird to the doubly-linked list. "d …" deletes a bird from the doubly-linked list. "e" ends reading from the file but does not end the overall menu. If a command from the file causes an error, print the error message on the console. So a sample file might have these lines:
    
    a eagle 20 7 25
    a robin 5 1 50
    d eagle
    e
    
    There will still be a user menu for the user to do things manually (as in Program 5a), but the menu will include an option to read from the file and an option to print birds in reverse order.
    
    For this program, the Bird class should be in Program6aBird and the main program should be in Program6a.
        
Show more…

Added by Esperanza B.

Computer Science and Information Technology
Computer Science and Information Technology
Trishna Knowledge Systems 2018 Edition
AceChat toggle button
Close icon
Ace pointing down

Please give Ace some feedback

Your feedback will help us improve your experience

Thumb up icon Thumb down icon
Thanks for your feedback!
Profile picture
Code in Java Please Write a program to manage birds sitting on a telephone wire. Each bird has a name, weight, size, and position. The wire is 200 feet long, and birds only sit on whole number points on the wire - that is, a bird can sit at 122, but not 121.8 or 122.5. The size of a bird determines how much space it takes - a bird of size 5 sitting at 110 means that bird occupies points 108, 109, 110, 111, and 112. Bird sizes are always odd integers. You will define a class Bird which keeps track of each bird's name, size, weight, and position (1 string, 3 integers). You will manage birds on the wire as a doubly-linked list. The minimum bird size is 1, and the maximum size is 9. The minimum weight is 1, and the maximum weight is 50. You will prompt the user with the options to add a bird, delete a bird (by name), calculate the total weight (If the total weight exceeds 300, then print a warning message for the user), print out the birds (name, weight, size, position) in order on the wire, print the birds backwards, read inputs from a file called bird_data.txt, or to end the program. bird_data.txt will have 3 types of lines: - a bird_name bird_weight bird_size bird_position - d bird_name - e These should act the same as if the user was entering things from the keyboard. I.e. "a …" adds a bird to the doubly-linked list. "d …" deletes a bird from the doubly-linked list. "e" ends reading from the file but does not end the overall menu. If a command from the file causes an error, print the error message on the console. So a sample file might have these lines: a eagle 20 7 25 a robin 5 1 50 d eagle e There will still be a user menu for the user to do things manually (as in Program 5a), but the menu will include an option to read from the file and an option to print birds in reverse order. For this program, the Bird class should be in Program6aBird and the main program should be in Program6a.
Close icon
Play audio
Feedback
Powered by NumerAI
Ivan Kochetkov Kathleen Carty
Danielle Fairburn verified

Akash M and 77 other subject AP CS educators are ready to help you.

Ask a new question

*

Labs

-

Want to see this concept in action?

NEW

Explore this concept interactively to see how it behaves as you change inputs.

View Labs

*

Key Concepts

-
Key Concept
Premium Feature
Explore the core concept behind this problem.
Play button
Key Concept
Premium Feature
Explore the core concept behind this problem.
Your browser does not support the video tag.

*

Recommended Videos

-
in-this-assignment-you-will-use-a-loop-and-a-custom-method-called-a-function-as-well-as-built-in-java-classes-create-a-java-program-that-meets-the-following-requirementsask-the-user-to-input-14581

In this assignment, you will use a loop and a custom method (called a "function"), as well as built-in Java classes. Create a Java program that meets the following requirements: Ask the user to input a number between 5 and 45, and tell the user to enter 1 if they wish to exit the program. Store the user's input in a variable with the integer data type. Use a while loop to repeat the program, checking the user's entry in case they entered a 1 to exit the program. A separate method called "checkEntry" has been created for you in the starting template below (note: You can restore the default code if you wish to start over by clicking the "Load default template…" link). In this method, take the user's entered number and process it such that IF the user enters a value of less than 35, the checkEntry method must multiply that value by 5 and return the result to main(). If the user instead enters a value greater than or equal to 35, the program must add 10 to that value and return the result to main(). Display the result of checkEntry's evaluation on the screen. Sample Values for Testing (paste into the "Enter program input (optional)" box below): 22 37 1 Important Notes (READ CAREFULLY!): When working correctly, this program will throw errors if you do not put a 1 at the bottom of the input sequence, as shown above. It is normal for this completed program to evaluate the exit condition (1), multiplying it by 5 and displaying the success message before terminating. This is the expected behavior for this assignment. This program does not check to see if the user failed to enter the right type of data. That topic will be examined later in this course. LabProgram.Java import java.util.Scanner; public class LabProgram { public static void main(String[] args) { // Type your code below this line. create additional lines as needed. // do not delete this line } public static int checkEntry(int incoming) { // Type your code for the checkentry method below this line. create additional lines as needed. // do not delete this line } }

Akash M.

python-programming-exercise-85-write-a-gui-based-program-that-plays-a-guess-the-number-game-in-which-the-roles-of-the-computer-and-the-user-are-the-reverse-of-what-they-are-in-the-case-study-61188

Programming Exercise 8.5 Instructions and the user are the reverse of what they are in the Case Study of this chapter. In this version of the game, the computer guesses a number between 1 (lowerBound) and 100 (upperBound) and the user provides the responses. • The window should display the computer's guesses with a label. • The user enters a hint in response, by selecting one of a set of command buttons labeled Too small, Too large, and Correct. • When the game is over, you should disable these buttons and wait for the user to click New game, as before. Be sure to use the field names provided in the comments in your starter code. File: guesswithgui.py Project 8.5 The computer guesses a number and the user provides the hints. import random from breezypythongui import EasyFrame class GuessingGame(EasyFrame): """Plays a guessing game with the user.""" def __init__(self): """Sets up the window, widgets, and data.""" EasyFrame.__init__(self, title = "Guessing Game") # self.lowerBound # self.upperBound # self.count self.myNumber = (self.lowerBound + self.upperBound) // 2 guess = "Is the number " + str(self.myNumber) + "?" self.myLabel = self.addLabel(text = guess, row = 0, column = 0, sticky = "NSEW", columnspan = 4) self.small = self.addButton(text = "Too small", row = 1, column = 0, command = self.goLarge) self.large = self.addButton(text = "Too large", row = 1, column = 1, command = self.goSmall) self.correct = self.addButton(text = "Correct", row = 1, column = 2, command = self.goCorrect)

Akash M.

create-a-package-named-reading_with_exceptions-write-a-class-named-readingwithexceptions-with-the-following-method-void-processstring-inputfilename-your-program-will-encounter-errors-and-we-41831

Create a package named "reading_with_exceptions". Write a class named ReadingWithExceptions with the following method: void process(String inputFilename) Your program will encounter errors, and we want you to gracefully handle them in such a way that you print out informative information and continue executing. 1. Your process routine will try to open a file with the name of inputFilename for input. If there is any problem (i.e. the file doesn't exist), then you should catch the exception, give an appropriate error, and then return. Otherwise, your program reads the file for instructions. 2. Your process routine will read the first line of the file looking for an outputFilename String followed by an integer. i.e.: outputFilename number_to_read. Your program will want to write output to a file having the name outputFilename. Your program will try to read from "inputFilename" the number of integers found in "number_to_read". 3. Your process method will copy the integers read from inputFilename and write them to your output file (i.e. outputFilename). There should be 10 numbers per line of output in your output file. 4. If you encounter bad input, your program should not die with an exception. For example: - If the count of the numbers to be read is bad or < 0, you will print out a complaint message and then read as many integers as you find. - If any of the other numbers are bad, print a complaint message and skip over the data. - If you don't have enough input numbers, complain but do not abort. 5. After you have processed inputFilename, I would like your program to then close the output file and tell the user that the file is created. Then open up the output file and copy it to the screen. For example, if inputFilename contained: MyOutput.txt 23 20 1 4 5 7 45 1 2 3 4 5 6 7 8 9 77 88 99 23 34 56 66 77 88 99 100 110 120 We would expect the output of your program to be (Note that after 23 numbers we stop printing numbers): MyOutput.txt created with the following output: 20 1 4 5 7 45 1 2 3 4 5 6 7 8 9 77 88 99 23 34 56 66 77 88 99 100 110 120 The main program will access the command line to obtain the list of filenames to call your process routine with.

Supreeta N.


*

Recommended Textbooks

-
Computer Science and Information Technology

Computer Science and Information Technology

Trishna Knowledge Systems 2018 Edition
achievement 1,236 solutions
Introduction to Programming Using Python

Introduction to Programming Using Python

Y. Daniel Liang 1st Edition
achievement 1,034 solutions
Computer Science - An Overview

Computer Science - An Overview

Glenn Brookshear, Dennis Brylow 12th Edition
achievement 1,343 solutions
Need help? Use Ace
Ace is your personal tutor. It breaks down any question with clear steps so you can learn.
Start Using Ace
Ace is your personal tutor for learning
Step-by-step explanations
Instant summaries
Summarize YouTube videos
Understand textbook images or PDFs
Study tools like quizzes and flashcards
Listen to your notes as a podcast
Continue solving this problem
Create a free account to:
  • View full step-by-step solution
  • Ask follow-up questions with Ace AI
  • Save progress and study later
Continue Free
Join the community

18,000,000+

Students on Numerade


Trusted by students at 8,000+ universities

Numerade

Get step-by-step video solution
from top educators

Continue with Clever
or



By creating an account, you agree to the Terms of Service and Privacy Policy
Already have an account? Log In

A free answer
just for you

Watch the video solution with this free unlock.

Numerade

Log in to watch this video
...and 100,000,000 more!


EMAIL

PASSWORD

OR
Continue with Clever