ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 22 May 2017 My Price 9.00

Draw the control flow graph to perform basic path testing

Software QA/Testing:

Suppose you want to perform basic path testing for the Java program given that calculates the Hotel Suites occupancy. These are located on floors 10-16. There is no 13th floor.

Draw the control flow graph to perform basic path testing.

import java.util.Scanner;
import java.text.*;
public class hotelOccupancy
{
public void calcRate()
{
   final int
       SUITES_PER_FLOOR = 20,   // Number of suites per floor
       MIN_FLOOR = 10,          // Lowest floor of suite units
       MAX_FLOOR = 16,          // Highest floor of suite units
      
      

       TOTAL_SUITES = (MAX_FLOOR - MIN_FLOOR) * SUITES_PER_FLOOR;
     
        Scanner scan = new Scanner(System.in);
        DecimalFormat fmt = new DecimalFormat();

   int occupied,                // Number of occupied suites on the floor
       totalOccupied = 0;       // Total number of occupied suites
  
   double occupancyRate;        // % of the suites that are occupied

   // Get and validate occupancy information for each floor
   System.out.println("Enter the number of occupied suites on each of the following floors.n");

   for (int floor = MIN_FLOOR; floor <= MAX_FLOOR; floor++)
   {
       if (floor == 13)
            continue;          // Skip thirteenth floor
      
       System.out.println("nFloor " + floor+ ": ");
       occupied=scan.nextInt();                                      
       while (occupied < 0 && occupied > SUITES_PER_FLOOR)
       {
           System.out.println("nThe number of occupied suites must be between 0 and " + SUITES_PER_FLOOR );
           System.out.println("n Re-enter the number of occupied suites on floor " + floor + ": ");
           occupied = scan.nextInt();
       }
    
       // Add occupied suites on this floor to the total
       totalOccupied += occupied;
   }
  
   // Compute occupancy rate in % form
   occupancyRate = 100* totalOccupied / TOTAL_SUITES;  

   // Display results
  
   System.out.println("nnThe hotel has a total of " + TOTAL_SUITES + " suites.n");
   System.out.println(totalOccupied+ " are currently occupied.n");
   System.out.println("This is an occupancy rate of " + fmt.format(occupancyRate)+ "% n");   
}
}

Answers

(11)
Status NEW Posted 22 May 2017 05:05 AM My Price 9.00

-----------

Attachments

file 1495430289-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)