Question

Java Help: Scenario: North Carolina Medical Supply is researching purchasing Flint, a surgical robot. They have...

Java Help:

Scenario: North Carolina Medical Supply is researching purchasing Flint, a surgical robot. They have gathered data from several sources and need you to write a program to arrange this data in a report. They want to know what is the average rating for Flint, which users have given Flint above average ratings, and which companies rated Flint below average. They also want to know the cost per Flint, since they have noticed a difference in price based on the number of robots purchased.

Sample Data:

Name of Company                            # of Robots                 Cost (No tax included)                            Rating

Hospital A 15                                        $250, 000                            Below Average

Hospital B 30                                     $450, 000                               Above Average

Hospital C 3                                       $75, 000                                 Below Average

Hospital D 50                                      $500, 000                            Above Average

0 0
Add a comment Improve this question Transcribed image text
Answer #1

/*
* The java program that displays the name of the hospital, number of robots,
* cost of purchase and rating and also print the cost per flint on console
* output as a table format
* */
//Exercise_1.java
public class Exercise_1
{
   public static void main(String[] args)
   {
       //an array of hospital names
       String hospitals[]=
           {"Hospital A",
                   "Hospital B",
                   "Hospital C",
           "Hospital D"};
       //an array of number of robots
       int robots[]= {15,30,3,50};
       //an array of costs of robots
       double cost[]= {250000,4500000,
               75000,500000};

       double avg=0;
       double total=0;

       for(int idx=0;idx<cost.length;idx++)
           total+=cost[idx];
       //find average cost
       avg=total/cost.length;

       System.out.printf("%-25s%-20s%-40s%-20s%-20s\n",
               "Name of Company",
               "# of Robots",
               "Cost(No tax included)",
               "Rating",
               "Cost/Flint");

//print the table format for the total details of flints
       for(int idx=0;idx<cost.length;idx++)
       {
           if(cost[idx]>avg)
           System.out.printf("%-35s%-30d$%-40.0f%-20s%-20.2f\n",
                   hospitals[idx],
                   robots[idx],
                   cost[idx],
                   "Above Average",
                   cost[idx]/robots[idx]);
           else
                   System.out.printf("%-35s%-30d$%-40.0f%-20s%-20.2f\n",
                           hospitals[idx],
                           robots[idx],
                           cost[idx],
                           "Below Average",
                           cost[idx]/robots[idx]);
       }
   }
}

Sample Output:

Name of Company # of Robots Cost(No tax included) Rating Cost/Flint
Hospital A 15 $250000 Below Average 16666.67
Hospital B 30 $4500000 Above Average 150000.00   
Hospital C 3 $75000 Below Average 25000.00
Hospital D 50 $500000 Below Average 10000.00

Add a comment
Know the answer?
Add Answer to:
Java Help: Scenario: North Carolina Medical Supply is researching purchasing Flint, a surgical robot. They have...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT