Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

0.75 gallon milk

27/03/2021 Client: saad24vbs Deadline: 2 Day

Lab 6.1: Fix My Program

We are asked to write a program to solve the following problem:

Suppose you have 5 1/2 gallons of milk and want to store them in milk jars that can hold up to 0.75 gallons each. You want to know ahead of time how many (the number of) completely filled jars you will have.

We therefore complete the problem-solving phase by using the Design Recipe:

MilkJarCalculator : number, number ; number

program is given the volume of milk in gallons (milkVolume) and the volume of each milk jar in gallons (jarVolume)

program calculates and outputs the exact number of jars that will be completely filled with milk (numberOfFullJars)

Examples:

-----------+-----------+--------------------

milkVolume | jarVolume | numberOfFullJars

-----------+-----------+--------------------

5.5 | 0.75 | 7

-----------+-----------+--------------------

5.5 | 1 | 5

-----------+-----------+--------------------

0 | 0.75 | ABORT (No Milk)

-----------+-----------+--------------------

-5.5 | 1 | ABORT (Owed Milk?)

-----------+-----------+--------------------

5.5 | 0 | ABORT (No Jars?)

-----------+-----------+--------------------

5.5 | -1 | ABORT (Huh????)

-----------+-----------+--------------------

Algorithm:

1. Get the milkVolume in gallons

2. If milkVolume is 0 or negative, ABORT program

3. Get the jarCapacity in gallons

4. If jarCapacity is 0 or negative, ABORT program

5. Calculate the numberOfFullJars as milkVolume/jarVolume

6. Output the numberOfFullJars

7. END program

We proceed to the implementation phase, and write the following program.

public class MilkJarCalculator

{

public static void main(String[] args)

{

double milkVolume; // gallons

double jarCapacity; // gallons

int numberOfFullJars; // number of completely filled jars of milk

// Get the milkVolume in gallons

milkVolume = 5.5;

// If milkVolume is 0 or negative, ABORT program (TO BE COMPLETED LATER)

// Get the jarCapacity in gallons

jarCapacity = 0.75;

// If jarCapacity is 0 or negative, ABORT program (TO BE COMPLETED LATER)

// Calculate the numberOfFullJars as milkVolume/jarCapacity

numberOfFullJars = milkVolume / jarCapacity;

// Output the numberOfFullJars

System.out.println(numberOfFullJars);

} // END program

} // end class MilkJarCalculator

However, when we compile the program, we get an error. What is wrong with it? Why? How can we fix it?

· Create a new NetBeans project named CPS150_Lab_6_1

·

· Copy and paste the highlighted code above to the project's main method

·

· Correct the code so that the whole number of completely filled milk jars is calculated and output.

·

Lab 6.2: Clean Up My Code

We are now asked to:

Write a program that converts yards to the number of feet, as well as the number of inches (e.g., there are 10.5 feet in 3.5 yards, and there are 126.0 inches in 3.5 yards).

Again, we complete the problem-solving phase using the Design Recipe:

ConvertYards : number ; number, number

program is given a distance measure in yards

program converts the measure to feet and to inches

Examples:

yards | feet | inches

------+------+--------

3.5 | 10.5 | 126.0

------+------+--------

0.0 | 0.0 | 0.0

------+------+--------

-3.5 | *** ABORT ***

------+------+--------

We incorporate our algorithm in a program:

public class ConvertYards

{

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Innovative Writer
Quality Assignments
Premium Solutions
Instant Homework Helper
Accounting & Finance Specialist
Math Exam Success
Writer Writer Name Offer Chat
Innovative Writer

ONLINE

Innovative Writer

I am known as Unrivaled Quality, Written to Standard, providing Plagiarism-free woork, and Always on Time

$61 Chat With Writer
Quality Assignments

ONLINE

Quality Assignments

I will cover all the points which you have mentioned in your project details.

$25 Chat With Writer
Premium Solutions

ONLINE

Premium Solutions

You can award me any time as I am ready to start your project curiously. Waiting for your positive response. Thank you!

$47 Chat With Writer
Instant Homework Helper

ONLINE

Instant Homework Helper

Hello, I an ranked top 10 freelancers in academic and contents writing. I can write and updated your personal statement with great quality and free of plagiarism

$22 Chat With Writer
Accounting & Finance Specialist

ONLINE

Accounting & Finance Specialist

You can award me any time as I am ready to start your project curiously. Waiting for your positive response. Thank you!

$54 Chat With Writer
Math Exam Success

ONLINE

Math Exam Success

Hello, I an ranked top 10 freelancers in academic and contents writing. I can write and updated your personal statement with great quality and free of plagiarism

$32 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

D10 particle size means - Week 5: Discussion: Perspectives that underpin your editorial thinking - Central field approximation for many electron atoms - Nuig exam results login - Timken bearing damage analysis poster - 55mm ring size australia - Nysc 36th and madison gay - Example of speech essay - What was hoover's solution to the great depression - A practical guide to advanced networking 3rd edition pdf - O in roman numerals - How to enrol in units mq - Strengths and weaknesses of consumer oriented evaluation approach - Matilda trunchbull house scene - Evaluating how a company system - Power Point-3 Team Management - Southern golden retriever society - Aon risk services v anu austlii - Tarbiyah meaning in english - Rolls royce aerospace supply chain - Pat by john ahearn and rigoberto torres - Research - In terms of globally integrated marketing communications adaptation is - Duke west campus housing - Olympic rent a car case study solution - Seasons come to pass page 244 - Driving test success anytime - Relatively low role ambiguity has been associated with higher remarital satisfaction. - Literary devices in the tempest - Essay 6 - Bob dhillon net worth - Select the statement that is true for apa formatted citations - Device management system calls - History paper - Trevor noah mountain winery tickets - Which consumer market segments best match with benihana - Ivy ledbetter lee formula for public relations - Gilles plains tafe map - Negative backpressure egr valve - Prospectus topic is how social media affects ones self esteem - Cardinal winning secondary school - Business government and society a managerial perspective text and cases - DB and power point - Social media in business communication ppt - Monash university council regulations - Bodega dreams setting - In an assembly operation at a furniture factory - Tianjin waysun food industries ltd - Use of space in drama - Cry - Systems development life cycle nursing informatics - Gomier manufacturing co ltd - A fan is turned off and its angular - Mcgraw hill marketing game - Data structure and Algorithm Analysis - Classical mythology in context pdf - White house farm medical centre - Why is derek miller's social media post different than most - How to make recycled paper in the classroom - Big Dudes in Sociology - Engineering ethics by charles fleddermann 4th edition - Where i m calling from summary - Assignment - St maurice's high school - 0737179697 MAMA SHANANI ABORTION CLINIC IN MOUNT FRERE - Fob shipping point accounting journal entry - Difference between classical and carnatic music - An academic narrative essay in which you demonstrate the role of the adult nurse in a variety of settings and insight into adults’ experiences of ill health - Against school john taylor gatto rhetorical analysis - Visual basic project done in visual studio - Two mile ash itt partnership - Grass singular or plural - Helping skills facilitating exploration insight and action 4th ed pdf - 4 h and 4t - Why do weeping willows weep math worksheet - Is cockapoo a recognized breed - ECE 332 WK 3 ASSIGNMENT 2 - Order 2338330: knowledge management theory - Ubc 1997 building code volume 2 - Fundamentals of nursing 9th edition potter and perry apa citation - Stages of moral reasoning - Emily dickinson i heard a fly buzz - Insulin onset peak duration table - Cask of amontillado essay prompts - How will you prepare a 10 solution of sugar - Tpc v australian meat holdings - Year 7 spelling words australia - Physics help 2 - Volume formula of a hexagonal prism - Rahimafrooz ips service center - Point of view video - Integrated waveguide technologies mini case - How to calculate total magnification of a microscope - A cat that has the genotype xoxo - What is a residual plot - Difference between gst payable and receivable - What are 3 main causes of the great depression - Appleton village surgery widnes - Latex or silicone swim cap - Abc site toowong development