Question

In: Computer Science

6) c programming Case study: In a certain building at a top secret research lab, some...

6) c programming Case study: In a certain building at a top secret research lab, some yttrium-90 has leaked into the computer analysts’ coffee room. The leak would currently expose personnel to 150 millirems of radiation a day. The half-life of the substance is about three days, that is, the radiation level is only half of what is was three days ago. The analysts want to know how long it will be before the radiation is sown to a safe level of 0.466 millirem a day. They would like a chart that displays the radiation level for every there days with message unsafe or sage after every line. The chart should stop just before the radiation level is on-tenth of the sage level, because the more cautious analysts will require a safety factor of 10.

Solutions

Expert Solution

I have used a series of '|' to represent a bar in C.

The code for the same is:

#include<stdio.h>

int main(){
    double curr_rad = 150;
    double sage_val = 0.466;

    //I am using the '|' to draw a bar representing the radiation level
    //One | represents 8 millirem radiation

    while(curr_rad > (sage_val/10)){

        //draw the level bar
        for(int i = 1; i <= (int)(8*curr_rad); i++)
            printf("|");

        //printing the radiation level
        printf("\nradiation value: %f", curr_rad);

        //if current radiation level is greater than sage value
        //print that the state is unsafe
        if(curr_rad > sage_val)
            printf("\nunsafe\n\n");
        
        //else it is sage
        else printf("\nsage\n\n");

        //radiation gets reduced to half after every three days
        curr_rad /= 2;
    }
    return 0;
}

Output:

The first two bars are looking equal in the output, but actually the series of '|' was very large as compared to the output screen. But the output is totally right.


Related Solutions

Case study: Bophal disaster. Research and write a detailed report on the disaster and some of...
Case study: Bophal disaster. Research and write a detailed report on the disaster and some of the key lessons from this inciden
Case Study Baseball Team Manager For this case study, you’ll use the programming skills that you...
Case Study Baseball Team Manager For this case study, you’ll use the programming skills that you learn in Murach’s Python Programming to develop a program that helps a person manage a baseball team. This program stores the data for each player on the team, and it also lets the manager set a starting lineup for each game. After you read chapter 2, you can develop a simple program that calculates the batting average for a player. Then, after you complete...
using lunix or C programming to answer this lab please fill in the blanks with the...
using lunix or C programming to answer this lab please fill in the blanks with the answere being highlighted, so i can understand. First, type the following command:             sort employee What is the order that employee is sorted in? ___________________________________________ Give a brief description of how the file is sorted. _____________________________________________________________________________________________________________________________________________________________________________________________________ Now, sort on the field for last name.         sort +1 employee Look at the sorted file. Are all the names sorted in alphabetical order? ______________________ Give a brief description...
Lab 1 Write a program in the C/C++ programming language to input and add two fractions...
Lab 1 Write a program in the C/C++ programming language to input and add two fractions each represented as a numerator and denominator. Do not use classes or structures. Print your result (which is also represented as a numerator/denominator) to standard out. If you get done early, try to simplify your result with the least common denominator. The following equation can be used to add fractions: a/b + c/d = (a*d + b*c)/(b*d) Example: 1/2 + 1/4 = ( 1(4)...
Assignment 1. Linear Programming Case Study Your instructor will assign a linear programming project for this...
Assignment 1. Linear Programming Case Study Your instructor will assign a linear programming project for this assignment according to the following specifications. It will be a problem with at least three (3) constraints and at least two (2) decision variables. The problem will be bounded and feasible. It will also have a single optimum solution (in other words, it won’t have alternate optimal solutions). The problem will also include a component that involves sensitivity analysis and the use of the...
Assignment 1. Linear Programming Case Study Your instructor will assign a linear programming project for this...
Assignment 1. Linear Programming Case Study Your instructor will assign a linear programming project for this assignment according to the following specifications. It will be a problem with at least three (3) constraints and at least two (2) decision variables. The problem will be bounded and feasible. It will also have a single optimum solution (in other words, it won’t have alternate optimal solutions). The problem will also include a component that involves sensitivity analysis and the use of the...
Instructions (In C++ Please) Verification This programming lab makes use of an array of characters. The...
Instructions (In C++ Please) Verification This programming lab makes use of an array of characters. The program will validate the characters in the array to see if they meets a set of requirements. Requirements: Must be at least 6 characters long (but not limited to 6, can be greater) Contains one upper case letter Contains one lower case letter Contains one digit Complete the code attached. Must use pointer while checking the characters. Download Source Lab 3 File: #include using...
Lab International Inc. Case Study What is the nature of the financing challenge facing LAB International?
Lab International Inc. Case Study What is the nature of the financing challenge facing LAB International?
c++ Programming For this assignment you will be building on your Fraction class. However, the changes...
c++ Programming For this assignment you will be building on your Fraction class. However, the changes will be significant, so I would recommend starting from scratch and using your previous version as a resource when appropriate. You'll continue working on your Fraction class for one more week, next week. For this week you are not required to provide documentation and not required to simplify Fractions. Please keep all of your code in one file for this week. We will separate...
In a c programming Write a program that converts upper case letters to lower case letters...
In a c programming Write a program that converts upper case letters to lower case letters or vice versa: Enter a sentence: What a GREAT movie is! Converted sentence: wHAT_A_great_MOVIE_IS_ Convert all non-alphabetical letters to ‘_’
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT