Login

Create Account
Customer Service Chat
+14156709189
info@expertsmind.com
Submit Homework/Assignment
Get quote & make Payment
Get Solution
pebble merchant, C/C++ Programming
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?
Posted Date: 8/30/2012 10:01:33 PM  Location : United States
Ask an Expert
Related Discussions:
pebble merchant, Assignment Help, Ask Question on pebble merchant, Get Answer, Expert's Help, pebble merchant Discussions
Write discussion on pebble merchant
Your posts are moderated
Write your message here..
Related Questions
Pebble merchant, c++ program
c++ program
Described inline function?, A: The inline keyword tells the compiler to sub...
A: The inline keyword tells the compiler to substitute the code in the function de_nition for each instance of a function call. Though, substitution takes place only at the compile
What about virtual destructor?, What about Virtual Destructor?
What about Virtual Destructor?
Array structure, We started off taking about input, output, CPU and memory ...
We started off taking about input, output, CPU and memory devices. Within C we need a method of storing large amounts of data in memory. We have used the idea of variables (pointer
Please help to solve a c program, Padovan String Problem Description A P...
Padovan String Problem Description A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n2) + P(n3), n>2 where + denotes s
Employee salary, wap to read an employee salary and calculate DA,HRA,pf,GRO...
wap to read an employee salary and calculate DA,HRA,pf,GROSS,NET conditions: BASIC DA HRA PF >10000 7% 9% 10% & >20000 9% 11% 15% &
Palindrome, Problem : Change to palindrome A palindrome is a string that r...
Problem : Change to palindrome A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your ta
Roman code python help , In general, Roman numerals can be converted mathem...
In general, Roman numerals can be converted mathematically by simply assigning a numerical value to each letter, according to the chart below, and calculating a total: M=1000  D=5
What is the issue which auto_ptr objects address?, A: If you employ auto_pt...
A: If you employ auto_ptr objects you would not need to be concerned along with heap objects not being deleted even if the exception is thrown.
What is union, What is Union? Intimately associated with the structure ...
What is Union? Intimately associated with the structure is the union which as well contains multiple members. Unlike a structure but the members of a union share the same stora
Assignment Help
Accounting Assignment Help
Economics Assignment Help
Finance Assignment Help
Statistics Assignment Help
Physics Assignment Help
Chemistry Assignment Help
Math Assignment Help
Biology Assignment Help
English Assignment Help
Management Assignment Help
Engineering Assignment Help
Programming Assignment Help
Computer Science Assignment Help
ExpertsMind Services
Online Tutoring
Projects Assistance
Exam Preparation
Coursework Help
Programming Help
IT Services
Why Us ?
~Experienced Tutors
~24x7 hrs Support
~Plagiarism Free
~Quality of Work
~Time on Delivery
~Privacy of Work