GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

The Daily Scrum Meetings should be used for problem solving.

The Daily Scrum Meetings should be used for problem solving.

Read Details

Review 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

What type of pasta is known for its bowtie shape?

What type of pasta is known for its bowtie shape?

Read Details

What two species of seafood from the Baltic and Black seas h…

What two species of seafood from the Baltic and Black seas have the Germans learned to enjoy fresh, pickled, and smoked?

Read Details

This famous Swiss-style French cheese is made in the lands s…

This famous Swiss-style French cheese is made in the lands surrounding the Jura Mountains in central France.

Read Details

The national dish of Chile is a mixture of beans, corn, and…

The national dish of Chile is a mixture of beans, corn, and squash called porotos granados.

Read Details

Pigs’ feet and snouts often appear in sauerkraut recipes in…

Pigs’ feet and snouts often appear in sauerkraut recipes in northern Germany.

Read Details

In what region of the world was fermented cabbage a well-kno…

In what region of the world was fermented cabbage a well-known tradition long before the Hungarians made the first sauerkraut?

Read Details

The famous Black Forest cake from southern Germany is flavor…

The famous Black Forest cake from southern Germany is flavored with spiced rum and dried apricots.

Read Details

What are cannelini, a popular ingredient in soups and side d…

What are cannelini, a popular ingredient in soups and side dishes throughout Italy?

Read Details

Posts pagination

Newer posts 1 … 37,364 37,365 37,366 37,367 37,368 … 75,853 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top