Java homework questions: Answer all exercises Not copied answer plzz Exercise 1 • Import and edit the Input04 project. • Run the code and examine the output. • Read through each next line until you find "BlueBumper". • The two numbers following "BlueBumper" are the object’s xPositon and yPosition. Store these coordinates as integers and print them. • Examine input04text.txt, if necessary.   Input04.java package input04; import java.util.Scanner; public class Input04 {     public static void main(String[] args){         Scanner sc = new Scanner(Input04.class.getResourceAsStream("input04text.txt"));                        //Edit these lines to advance the scanner         sc.nextLine();         System.out.println(sc.nextLine());                           //Does this line contain "BlueBumper"?         System.out.println(sc.findInLine("BlueBumper"));         //Store the next two numbers as xPosition and yPosition         //Print these positions                           System.out.println("X: "        +", Y: "        );         sc.close();     }     } input04text.txt 128 3.141 Puppies! Line2 This is Line2. 100002 This is still Line2. Line3 Line4 444 BlueBumper 90 120 Exercise 2: • Import and edit the Chickens01 project. • Read this story and calculate/print the totalEggs collected between Monday and Wednesday: – Farmer Brown’s chickens always lay eggsPerChicken eggs precisely at noon, which he collects that day. – On Monday, Farmer Brown has chickenCount chickens. – On Tuesday morning, Farmer Brown gains 1 chicken. – On Wednesday morning, a wild beast eats half the chickens! – How many eggs did Farmer Brown collect if he starts with … • eggsPerChicken = 5, chickenCount = 3 • eggsPerChicken = 4, chickenCount = 8 Your program should produce the following output: 45 First scenario 84 Second scenario Chickens01.java package chickens01; public class Chickens01 {     public static void main(String[] args) {         //Put yout code here                  System.out.println(totalEggs);     }    } Exercise 3 Import and edit the Chickens02 project. • Read this story and calculate/print the required values: – On Monday, Farmer Fred collects 100 eggs. – On Tuesday, Farmer Fred collects 121 eggs. – On Wednesday, Farmer Fred collects 117 eggs. – What is the dailyAverage of eggs collected? – How many eggs could be expected in a 30-day monthlyAverage? – If an egg can be sold for a profit of $0.18, what is Farmer Fred’s total monthlyProfit for all eggs? Your program should produce the following output: Daily Average: 112.66666666666667 Monthly Average: 3380.0 Profit: $608.4 Chickens02.java package chickens02; public class Chickens02 {     public static void main(String[] args) {         //Put yout code here         System.out.println("Daily Average:   " +dailyAverage);         System.out.println("Monthly Average: " +monthlyAverage);         System.out.println("Monthly Profit:  $" +monthlyProfit);     }      }

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

Java homework questions:

Answer all exercises Not copied answer plzz

Exercise 1

• Import and edit the Input04 project.

• Run the code and examine the output.

• Read through each next line until you find "BlueBumper".

• The two numbers following "BlueBumper" are the object’s xPositon and yPosition. Store these coordinates as integers and print them.

• Examine input04text.txt, if necessary.

 

Input04.java

package input04;

import java.util.Scanner;

public class Input04 {
    public static void main(String[] args){
        Scanner sc = new Scanner(Input04.class.getResourceAsStream("input04text.txt"));      
        
        //Edit these lines to advance the scanner
        sc.nextLine();
        System.out.println(sc.nextLine());

        
        
        //Does this line contain "BlueBumper"?
        System.out.println(sc.findInLine("BlueBumper"));
        //Store the next two numbers as xPosition and yPosition
        //Print these positions
        
        
        System.out.println("X: "        +", Y: "        );
        sc.close();
    }    
}

input04text.txt

128 3.141 Puppies!
Line2 This is Line2. 100002 This is still Line2.
Line3
Line4 444 BlueBumper 90 120
Exercise 2:

• Import and edit the Chickens01 project.

• Read this story and calculate/print the totalEggs collected between Monday and Wednesday:

– Farmer Brown’s chickens always lay eggsPerChicken eggs precisely at noon, which he collects that day.

– On Monday, Farmer Brown has chickenCount chickens.

– On Tuesday morning, Farmer Brown gains 1 chicken.

– On Wednesday morning, a wild beast eats half the chickens!

– How many eggs did Farmer Brown collect if he starts with …

• eggsPerChicken = 5, chickenCount = 3

• eggsPerChicken = 4, chickenCount = 8

Your program should produce the following output:

45 First scenario

84 Second scenario

Chickens01.java

package chickens01;

public class Chickens01 {
    public static void main(String[] args) {
        //Put yout code here
        
        System.out.println(totalEggs);
    }   
}
Exercise 3

Import and edit the Chickens02 project.

• Read this story and calculate/print the required values:

– On Monday, Farmer Fred collects 100 eggs.

– On Tuesday, Farmer Fred collects 121 eggs.

– On Wednesday, Farmer Fred collects 117 eggs.

– What is the dailyAverage of eggs collected?

– How many eggs could be expected in a 30-day monthlyAverage?

– If an egg can be sold for a profit of $0.18, what is Farmer Fred’s total monthlyProfit for all eggs?

Your program should produce the following output:

Daily Average: 112.66666666666667

Monthly Average: 3380.0

Profit: $608.4

Chickens02.java
package chickens02;

public class Chickens02 {
    public static void main(String[] args) {
        //Put yout code here

        System.out.println("Daily Average:   " +dailyAverage);
        System.out.println("Monthly Average: " +monthlyAverage);
        System.out.println("Monthly Profit:  $" +monthlyProfit);
    }
    
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Unreferenced Objects
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
  • SEE MORE 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