Deep outer space, far from any solar systems or stars, is ex…
Deep outer space, far from any solar systems or stars, is extremely cold at a temperature of about -455°F (2.59 K). Although we think of outer space as being “empty”, there are approximately 1,000,000 atoms/m3in these regions of “empty” space. What is the pressure due to the gas in these regions? Compare this mathematically to atmospheric pressure here on Earth.
Read DetailsWrite a complete essay that does not use first (I, me, my, m…
Write a complete essay that does not use first (I, me, my, mine, we, us, our, etc.) or second person pronouns (you, your. you’re, etc.) on one of the following topics: Classify types of music genres. or Classify types of sports fans.
Read DetailsAssume you have the following .proto file. message Person …
Assume you have the following .proto file. message Person string name = 1; int32 month = 2; int32 day = 3; int32 year = 4; } Assume this describes a request to the server, so the client wants to add a new person to their contacts with the above mentioned information. 1. Write the code for the client creating a correct proto Request of type Person and sending it over to the server. You can assume this is a part of the Client Code where we have a Socket, OutputStream and InputStream (of course this is only a snippet). serverSock = new Socket(host, port); out = serverSock.getOutputStream(); in = serverSock.getInputStream(); 2. Write the code to read in the request on the server side and print out the name and birth year. I do not care exactly about the Java Syntax in detail but I do want to see that you know how to handle proto, build and read the objects. Tip: Methods to read and write with proto on an OutputStream and InputStream writeDelimitedTo(out); parseDelimitedFrom(in);
Read DetailsReview the provided code for the Rewards Program. Identify a…
Review the provided code for the Rewards Program. Identify at least five issues related to: Consistency and naming conventions. Code smells and maintainability. Logical correctness and future adaptability. For each issue: Explain the problem clearly. Propose a concrete improvement. Suggest one test case for the calcreward and one for gettype methods to ensure proper functionality. public class Rewardz { /** * Calculates the total amount after applying discounts based on item count and spending. * * @param t Total amount spent by the customer * @param i Number of items purchased * @return Adjusted total amount after discounts */ public double calcreward(double t, int i) { if (i > 5) { t = t – (t * 0.05); // 5% discount for more than 5 items } if (i > 15) { t = t – (t * 0.1); // 10% discount for more than 15 items } if (t > 200) { t = t – 20; // Flat $20 discount for spending over $200 } return t; } /** * Determines the customer’s reward tier based on spending history. * * @param p Number of purchases made * @param sp Total spending across all purchases * @return The customer reward tier as a string (“Gold”, “Silver”, “Bronze”) */ public String gettype(int p, double sp) { if (sp > 1000) { return “gold”; } else if (sp >= 500) { return “silver”; } else { return “bronze”; } } public void main(String[] args) { Rewardz r = new Rewardz(); double reward = r.calcreward(250, 10); System.out.println(“Total Reward: ” + reward); String custType = r.gettype(8, 750); System.out.println(“Customer Type: ” + custType); }}
Read Details