Question

In: Computer Science

5. Paint the ceiling You want to build yourself a house. The building company you hired...

5. Paint the ceiling You want to build yourself a house. The building company you hired can only build houses with sides from their specific set s. That means they can build you a square house or a rectangular one but if and only if its length and width belong to the set s. This month, they have a special promotion: they will paint the ceiling of a new house for free...but only if its area is not more than a. You want them to do it for free but you also want to be sure that the house will be comfortable and not too small. How many possible house configurations can you create to have the ceiling painted for free given the side lengths offered? There is a method to how the company decides what lengths of sides to produce. To determine n lengths of wall segments to offer, they start with a seed value s0, some variables k, b and m, and use the following equation to determine all other side lengths s[i]: s[i]=((k*s[i-1]+b) mod m)+1+s[i-1]) for 1 si

Solutions

Expert Solution


import java.util.Arrays;
import java.util.Scanner;

public class RoomCeiling {

        public static void main(String[] args) {
                // TODO Auto-generated method stub
                Scanner src=new Scanner(System.in);
                int count=0;
                System.out.println("Enter the value of n(no. of length sides offered):");
                int n=src.nextInt();
                int[] s=new int[n];
                System.out.println("Enter the maximum area of ceiling(a):");
                int a=src.nextInt();
                System.out.println("Enter the seed value s0:");
                s[0]=src.nextInt();
                System.out.println("Enter the value of k:");
                int k=src.nextInt();
                System.out.println("Enter the value of b:");
                int b=src.nextInt();
                System.out.println("Enter the value of m:");
                int m=src.nextInt();
                for(int i=1;i<n;i++)
                {
                        s[i]=(k*s[i-1]+b)%m+1+s[i-1];
                }
                Arrays.sort(s);
                for(int i=0;i<n;i++)
                {
                        for(int j=1;j<n;j++)
                        {
                                if(s[i]*s[j]<=a)
                                        count++;
                                else
                                        break;
                        }
                }
                System.out.println("Possible no. of combiation are:"+count);

        }

}

Related Solutions

Brilliant Paint Company You have been hired as a consultant for Brilliant Paint Company, Inc. (BPC),...
Brilliant Paint Company You have been hired as a consultant for Brilliant Paint Company, Inc. (BPC), manufacturers of fine industrial paint. The market for industrial paint is growing rapidly. The company bought some land three years ago for $1.35 million in anticipation of using it as a toxic paint waste dump site but has recently hired another company to handle all toxic materials. Based on a recent appraisal, the company believes it could sell the land for $1.45 million on...
In a closed room, you turn the ceiling fan on to cool yourself down as you...
In a closed room, you turn the ceiling fan on to cool yourself down as you complete an online exam. Over time, will the temperature in the room increase/decrease/stay the same? Support your answer using explanations/equations as necessary.
Build a HOUSE OF QUALITY of a Logistics and Distribution Company
Build a HOUSE OF QUALITY of a Logistics and Distribution Company
Suppose you paint your house this year, using $200 of paint bought this year and saving...
Suppose you paint your house this year, using $200 of paint bought this year and saving $900 in labor that would have been paid to a painting company. How much does GDP increase this year? a. $900, since paint is considered a durable good. b. $200. c. 1,100, since your labor value is imputed. d. $0, since this is do-it-yourself activity.
Part A: You have been hired by a company to build a predictive analytics model to...
Part A: You have been hired by a company to build a predictive analytics model to increase their sales. Before building the model, your manager asked you to start with exploratory data analysis and report the findings. Which visualization tools would you use to display important properties of data such as outliers, range of data, mean, IQR, and distribution of data, etc.? Be specific about the tools and methods that display the skewness, similarity of distributions, and whether data comes...
You want to buy a house 5 years from now, and you plan to save $4100...
You want to buy a house 5 years from now, and you plan to save $4100 per year. beginning Immediately. You will make 5 deposits in an account that pays 4.3% interest. Under these assumptions, how much will you have 5 years from today? Company XYZ soustanding bonds have a $1.000 value and they mature in 25 years. Their nominal yield to maturity is 9.66 % they pay interest semiannually, and they sell at a price of $850. What is...
You have been hired as a consultant for Brilliant Paint Company, Inc. (BPC), manufacturers of fine...
You have been hired as a consultant for Brilliant Paint Company, Inc. (BPC), manufacturers of fine industrial paint. The market for industrial paint is growing rapidly. The company bought some land three years ago for $1.35 million in anticipation of using it as a toxic paint waste dump site but has recently hired another company to handle all toxic materials. Based on a recent appraisal, the company believes it could sell the land for $1.45 million on an after-tax basis,...
You have been hired as a consultant for Brilliant Paint Company, Inc. (BPC), manufacturers of fine...
You have been hired as a consultant for Brilliant Paint Company, Inc. (BPC), manufacturers of fine industrial paint. The market for industrial paint is growing rapidly. The company bought some land three years ago for $1.35 million in anticipation of using it as a toxic paint waste dump site but has recently hired another company to handle all toxic materials. Based on a recent appraisal, the company believes it could sell the land for $1.45 million on an after-tax basis,...
You have been hired as a consultant for Brilliant Paint Company, Inc. (BPC), manufacturers of fine...
You have been hired as a consultant for Brilliant Paint Company, Inc. (BPC), manufacturers of fine industrial paint. The market for industrial paint is growing rapidly. The company bought some land three years ago for $1.35 million in anticipation of using it as a toxic paint waste dump site but has recently hired another company to handle all toxic materials. Based on a recent appraisal, the company believes it could sell the land for $1.45 million on an after-tax basis,...
Oliver Owner wishes to build an office building. Oliver hired Original Architect, Inc. to create the...
Oliver Owner wishes to build an office building. Oliver hired Original Architect, Inc. to create the design. Over several months, Original Architect, Inc. gave Oliver several drafts of increasing detail. Uninspired by what he saw, Oliver terminated its contract with Original Architect, Inc. and hired Replacement Architect, Inc. in its place. Oliver gave Replacement Architect, Inc. the last drawing Oliver had received from Original Architect, Inc. Replacement Architect, Inc. used this last drawing to create its own final design. Oliver...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT