Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE HELP IN JAVA. THANK YOU (14 points) Problem 4-Write a program Submit a program called: Chicken.java The following program compares the total number of
PLEASE HELP IN JAVA. THANK YOU
(14 points) Problem 4-Write a program Submit a program called: Chicken.java The following program compares the total number of eggs (laid by chickens) that two farmers have. The user of the program types inputs in the form Chicken dash number of eggs (for example Chicken1-4 where Chicken1 is the chicken and 4 is the number eggs separated by a dash.) Define the following methods used in the main import java.util.Scanner public class Chickern /*This method returns a String array filled with information for one of the farmers. Every element in the array should be in the form shown in the sample run (for example, Chicken1- 5). You can assume the user always enters this information separated by a dash.* public static String [I getlnput(String message) //write code here /*This method returns the total number of eggs laid by chickens for a specific farmer. It takes the array of information entered by the user (holding information like Chicken1-2). It returns the total number of eggs."/ public static int totalEggs(String s) //write code here public static void main(String[] args) String farmerOne-getlnput(-Info for first farmer:"); String [] farmerTwozgetinput("-Info for second farmer:"); int numOne totalEggs(farmerOne); int numTwo totalEggs(farmerTwo); if(numOneStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started