Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask Java Expert


Home >> Java

General Instructions
• prepare a fully documented Java program to solve the problem given below.
• Make use of methods and arrays in your program.

problem)

You are given three bins, each containing a specified number of red (R), green (G) and blue (B) balls. You are required to move the minimum number of balls so that each bin will finally contain balls of one colour only.
The Input
The input data consists of 9 integers. The first three integers represent the number of red, green and blue balls respectively in the first bin; the second three represent the number of red, green and blue balls respectively in the second bin; the third three represent the number of red, green and blue balls respectively in the third bin.
The Output
Your program output must consist of the three letters (R, G, B) given in an order to indicate the final colour of the balls in the first, second and third bins, respectively. This is followed by the minimum number of balls moved.

ex

The input data:
5 10 5 20 10 5 10 20 10

means that the first bin contains 5 red balls, 10 green balls and 5 blue balls; the second bin contains 20 red balls, 10 green balls and 5 blue balls; and the third bin contains 10 red balls, 20 green balls and 10 blue balls. For this data, the correct output would be:

B R G 50

meaning that 50 balls (the minimum) must be moved so that the first bin contains only blue balls, the second bin contains only red balls and the third bin contains only green balls.

Java, Programming

  • Category:- Java
  • Reference No.:- M9338

Have any Question? 


Related Questions in Java

Develop an application in java to accept the number of

Develop an application in Java to accept the number of students in a section for a subject and for each student accept the student number, Student name, prelim marks, midterm marks, final marks. The final grade should be ...

Chapter 1 - challenge 3 - training workshopsyour company

Chapter 1 - Challenge #3 - Training Workshops Your company likes to present training workshops that help people in the information technology industry improve their skills. Your task is to write and object-oriented appli ...

Overviewthis assignment is intended to familiarize students

Overview: This assignment is intended to familiarize students with web application design, basic servlet functionality, and application deployment with a focus on servlet HTML generation and page navigation. The goal is ...

This assignment is based on the principles of clock

This assignment is based on the principles of clock consistency and associated drifts in a distributed system. You have to create a simulation, running on a single machine, of a simple distributed system involving four p ...

Topic java part a airline seatingmillions of commercial

Topic: Java Part A: Airline seating Millions of commercial airline flights cross the world's cities every year, and each one of these flights must solve what seems like a simple problem: how do you arrange where each pas ...

Animal characteristicsin todays fast-paced world it is

Animal characteristics In today's fast-paced world, it is important for programmers to think about potential future changes that impact their programs. One way that software developers can address this concern is by desi ...

Java- object-oriented and concurrent programmingheres a

Java- Object-Oriented and Concurrent Programming Here's a very quick overview of the projects: 1. Read a data file, create the internal data structure, create a GUI to display the structure, and let the user search the s ...

Instructionsi what are the diagrams defined in the uml

Instructions I. What are the diagrams defined in the UML Standard. Give a one or two sentence description of each one. II. Given the following code, how should the toString methods in the classes H2ClassA and H2ClassB be ...

Write two java program by netbeans1 create a program that

Write two java program by Netbeans. 1. Create a program that ask for a radius of a circle and has the ability to return both the Area and Circumference - so methods call getArea() and getCircumferance() 2. Create a progr ...

The class below has some errors for each error do the

The class below has some errors. For each error do the following: a) Write the erring section of code and explain what the error is. b) Fix the error (i.e. re-write the code correctly). public class ClassWithErrors { pub ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate