Question: C++ question! Please don't use strange functions and methods A local rancher has asked you to help them come up with a plan for laying
C++ question!
Please don't use strange functions and methods




A local rancher has asked you to help them come up with a plan for laying fencing on their property. They need you to print out a blueprint for how to lay the fencing where a ' represents a post, a epresents a foot of fencing and a S' represents a single no trespassing sign. Your task write a C++ program that prompts the user for input, and then calculates and prints ou() the fence blueprint and (ii) how many signs to order Rules: Your program must prompt for the following: the total number of posts, the number of feet between posts, and the minimum feet between signs. . A sign may NOT be adjacent to a post or on a post. . For any section between two posts, the number of feet of fence laid + the width of any signs(s) set must be equal to the feet between posts. There can be no 'missing feet between posts. There can be no extra feet between posts. The distance between signs is regulated by the minimum feet between signs. If possible the next sign must be this minimum number from the previous sign. If a sign cannot be located the minimum number, then the sign must be placed in the next allowable location. The width of every sign is 1 foot. No partial feet of fence may be laid. No partial signs may be set. All fence and signs is measured in whole feet Posts have a 0 foot width. Posts shall not cause the length of the fence to increase The first sign must be at least the minimum feet between signs from the initial post . The minimum feet between signs is the minimum needed feet of fence between signs. Example: in the output I-S--S--S- the feet between the first sign and the second sign is 2. Example 1 (user input is underlined) How many posts do you want to use? How many feet between posts? What is the minimum distance between signs (in feet)? I--S--1-S-1-S--I-S-I Total Signs: 4 Example 2 (user input is underlined) How many posts do you want to use? How many feet between posts? 10 What is the minimum distance between signs (in feet)? 16 Total Signs: 4 Example 3 (user input is underlined) How many posts do you want to use? Example 3 (user input is underlined) How many posts do you want to use? How many feet between posts? 20 What is the minimum distance between signs (in feet)? 60 -I -I Total Signs: 0 Tips: . You will need several loops and if statements. . You will need to track exactly how far along the fence you have gone. Consider building a string incrementally and printing the string out at the end of the program this will allow you to use cout's for debug statements. Assumptions and further clarification: Assume that the fence in question does NOT form a circuit, (ie., it does not end at its first post, but that the first and last posts are different), and that is is composed of individual fence segments (i.e., there is no overlapping of segments, no places the fence crosses itself, etc.) Assume all inputs will be > 0 . It is possible that no signs could be set. See Example 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
