Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, This is my first time using cramster, so I hope I\'m doing thiscorrectly.

ID: 3609936 • Letter: H

Question

Hello,
This is my first time using cramster, so I hope I'm doing thiscorrectly. Here goes...
I need a lot of help with my java homework. Starting with thisquestion in the book.
-------
CHEX26) A real estate office handles 50 apartments units. Whenthe rent is $600 per month, all units are occupied. However, foreach $40 increase in rent, one unit becomes vacant. Each occupiedunit requires and average of $27 per month for maintenance. Howmany units should be rented to maximize the profit?
Write a program that prompts the user to enter:
a) The number of apartment units
b) The rent to occupy all the units
c) The increase in rent that results in a vacant unit
d) Amount to maintain a rented unit
The program then outputs the number of units to be rented tomaximize the profit.
----
My professor also said for extra credit, to have the resultsappear in some sort of chart, like a line chart. However, he hasn'ttaught this yet. If anyone knows how to do that, I would be verygrateful.
I appreciate any help given. My computer was wrecked in anaccident, so I've been unable to particpate in class for a monthand a half. So unfortunately, I'm wicked behind and am very lostunfortunately. Thanks for anyone who can lend a hand.
~Kantoro
This is my first time using cramster, so I hope I'm doing thiscorrectly. Here goes...
I need a lot of help with my java homework. Starting with thisquestion in the book.
-------
CHEX26) A real estate office handles 50 apartments units. Whenthe rent is $600 per month, all units are occupied. However, foreach $40 increase in rent, one unit becomes vacant. Each occupiedunit requires and average of $27 per month for maintenance. Howmany units should be rented to maximize the profit?
Write a program that prompts the user to enter:
a) The number of apartment units
b) The rent to occupy all the units
c) The increase in rent that results in a vacant unit
d) Amount to maintain a rented unit
The program then outputs the number of units to be rented tomaximize the profit.
----
My professor also said for extra credit, to have the resultsappear in some sort of chart, like a line chart. However, he hasn'ttaught this yet. If anyone knows how to do that, I would be verygrateful.
I appreciate any help given. My computer was wrecked in anaccident, so I've been unable to particpate in class for a monthand a half. So unfortunately, I'm wicked behind and am very lostunfortunately. Thanks for anyone who can lend a hand.
~Kantoro

Explanation / Answer

import java.io.*; import java.lang.*; import java.util.*; public class Rent{ public int apartments; public int rent; public int increase; public int maintenance; /* public Rent(int apartments, int rent, int increase, intmaintenance){ this.apartments =apartments ; this.rent = rent ; this.increase = increase ; this.maintenance = maintenance ; } */ public void evalMaxprofit(){ int numApartments = apartments; int maxRent = 0; int maxProfit = 0; int maxApartments=0; int unoccupied = 0; int curRent= rent; int profit = 0; System.out.println("Number of unitssoccupied      Rent               profit"); while(unoccupied
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote