pebble merchant, JAVA Programming

Assignment Help:
There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides.
But he sometimes mistakes doing that and the mistakes result in losses. So, he comes to you, and asks you to make a small intelligent car,
which could run along the room’s walls and calculate their length. The car has to come back from where it’s started.
This means the starting point is the same as the ending one. When the car gives the length of the room’s walls,
you could calculate the surface area of the floor. Knowing the surface area, you could calculate the price for covering the whole floor with pebbles.
3 kilograms of pebbles are needed for covering an area of 1 square meter . The rate of the pebbles is $5 per kilogram.
For example The car’s measurements are illustrated, using two arrays. Array 1 = {L, R, L, R, R, L, R, R, L, R, R, L, R, L, L, R, Z}
Where L denotes, that the car turned Left. R denotes, that the car turned Right. Z denotes, that the finishing point is after the last turn.
The following picture will clear any misunderstandings (on this example Array 1 = {L,R,R,R,Z})

Array 2 = {3, 4, 2, 3, 2, 4, 5, 4, 2, 3, 2, 1, 2, 2, 2, 1, 2} An element of Array 2 denotes the length (in meters), covered by the car,
after taking the corresponding turn. {3L, 4R, 2L, 3R, 2R, 4L, 5R, 4R, 2L, 3R, 2R, 1L, 2R, 2L, 2L, 1R, 2Z}
In this representation it is clearly visible that the direction from entry turning point is measured, along with the distance to the next turning point.
The last element Z in Array 1 represents that the corresponding length in the Array 2 is the final distance and the car will be at finishing point after
covering this length.

The area of the given picture is 63 square meters and the cost for covering it is $945.
Step 1:
In your Solution File:
Implement your logic in the function int * findCost(char direction[],int length[]).
char direction[] : is a character array which represents turning direction of car.
int length[] : is an integer array, which represents the length, traveled by the car, in each direction.
You can create more functions if required, but those functions should be in the same file.

Step 2:
Your solution needs to consider the following constraints.
In this problem you have to make a program for the pebble merchant.
His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that and the mistakes result in losses.
So, he comes to you and asks you to make a small intelligent car, which could run along the room’s walls and calculate their length.
The car has to come back from where it started.
This means the starting point is the same as the ending one.
The direction array contains only L, R and Z in UPPER CASE; otherwise return {0,0}
The Prototype of the function is
int * findCost(char direction[],int length[]). This method takes the following arguments:
direction is a character array, which represents the turning directions of the car.
length is an integer array, which represents the length, traveled by the car, in each direction.

This method returns an integer array having two elements first is the calculated area and second is the estimated cost.
The constraints are:
The direction array contains only L, R and Z in UPPER CASE; otherwise return {0,0}
The direction array''''s last element should be Z; otherwise return {0,0}
Each element in the length array should be greater than 0; otherwise return {0,0}
write a progrm to design it?

Related Discussions:- pebble merchant

JSP and servlet, I just finished a small tutorial on JSP and servlet now I...

I just finished a small tutorial on JSP and servlet now I was looking for some assignments so that I can try my hands on

What is an objects lock, What is an object's lock and which objects have lo...

What is an object's lock and which objects have locks? An object's lock is a mechanism that is used by multiple threads to get synchronized access to the object. A thread may i

Program for randomly generated 3- digit number matches, Program for Randoml...

Program for Randomly Generated 3- Digit Number Matches This assignment demonstrates your ability to use basic Java syntax including selection and looping statements. You will

Explain about the interpreter in java, Machines should have Java interprete...

Machines should have Java interpreter for the Java byte code to get implemented. Linking is a very simple process and this feature helps while developing applications. Java compile

What is javaserver faces expression language, A easy expression language us...

A easy expression language used by a JavaServer Faces UI component tag attributes to bind the associated component to a bean property or to bind the associated component's value to

Socket programming in Java: TCP, Objectives: socket programming in Java: TC...

Objectives: socket programming in Java: TCP Exercises: Goal: In this project we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web ser

Program for write a class with the header, PART1: Write a class with the...

PART1: Write a class with the header public class OrderedPair > implements Comparable > instance variables private Key x private Key y constructor publicOrd

Applet draw a face , Write a Java Applet which will draw a face on applet a...

Write a Java Applet which will draw a face on applet as follows:   b)    Modify the program now by adding two Buttons (Java version of ActiveX Control) named Smily Fac

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd