answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andru [333]
2 years ago
4

A data file "parttolerance.dat" stores on one line, a part number, and the minimum and maximum values for the valid range that t

he part could weigh. Write a script "parttol" that will read these values from the file, prompt the user for a weight, and print whether or not that weight is within range. For example, IF the file stores the following:>> type parttolerance.dat123 44.205 44.287Here might be examples of executing the script:>> parttolEnter the part weight: 44.33The part 123 is not in range>> parttolEnter the part weight: 44.25The part 123 is within range
Computers and Technology
1 answer:
makvit [3.9K]2 years ago
7 0

Answer:

First, create the parttolerance.dat file with the line in the question. This can easily be done by using the echo command from the command line:

echo 123 44.205 44.287 >> parttolerance.dat

Then write a simple script file that prompts the user for the weight and then compares that input to the values within the file created above. If the value of the weight is within the range, then print the value is within range. Otherwise print it is not within range.

Explanation:

// create the parttolerance.dat file

echo 123 44.205 44.287 >> parttolerance.dat

Shell script

 #!/bin/bash echo

 "Enter the part weight: "

 read input_weight

  IFS=' ' while IFS=' '

 read -r col1 col2 col3  do    

   part_number="$col1"    

   file_weight_lower="$col2"    

   file_weight_upper="$col3"

 done <parttolerance.dat

  if (( $(bc <<< "$input_weight >= $file_weight_lower && $input_weight <= $file_weight_upper") > 0 )); then  

   echo "The part $part_number is within range"

 else  

   echo "The part $part_number is not in range"

 fi

run script:

./parttol.sh

You might be interested in
5. You just bought a new hard drive for youYou plan to use this as a secondary hard drive to store allcomputeryour UMA files. On
wel
Format and mount the drive. 
Formatting erases the drive and sets it up so the system can read and write to it.
Mounting the drive allows the system to have access to the drive and read and write to it. 

If you want to get more specific in Windows you can open registry editor and change the paths of the drive to save in the new location.
4 0
2 years ago
1. What is the global marketplace?
VladimirAG [237]

I know the answer for 1 is A

5 0
2 years ago
Read 2 more answers
Viet drives around and checks meters to document the amount of electricity used in homes. What Energy pathway is he a part of? E
Svet_ta [14]
As Viet drives around and checks meters to document the amount of electricity used in homes he would be part of the energy distribution process since the electricity is distributed off  a power line into the house and then within the house by the wiring to the lights and the electrical outlets for usage by the inhabitants.
7 0
2 years ago
Read 2 more answers
3.26 LAB: Leap Year A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate a
Taya2010 [7]

Answer:

// program in C++ to check leap year.

// include header

#include<iostream>

using namespace std;

// main function

int main() {

// variable

  int inp_year ;

  // ask user to enter year

  cout<<"Enter year:";

  // read year

  cin>>inp_year;

  // check year is leap or not

  if (((inp_year % 4 == 0) && (inp_year % 100 != 0)) || (inp_year % 400 == 0))

  // if leap year , print leap year

     cout<<inp_year<<" is a leap year.";

  else

  // print not leap year

     cout<<inp_year<<" is not a leap year.";

  return 0;

}

Explanation:

Read year from user.Then check if year is divisible by 4 and not divisible by 100 or year is divisible by 400 then year is leap year.otherwise year is not  leap year.

Output:

Enter year:1712                                                                                                            

1712 is a leap year.

6 0
2 years ago
Read 2 more answers
In this problem we consider sending real-time voice from Host A to Host B over a packet-switched network (VoIP). Host A converts
Minchanka [31]

Answer:

<u>The total time elapsed from the time a bit is created (from the original analog signal at Host A) until the bit is decoded (as part of the analog signal at Host B is </u><u>25.11 ms</u>

Explanation:

Host A first converts the analog signal to a digital 64kbps stream and then groups it into 56-byte packets. The time taken for this can be calculated as:

time taken 1= \frac{Packet Size in Bits}{Bit Rate}

                 = (56 x 8) bits / 64 x 10³ bits/s

                 = 7 x 10⁻³s

time taken 1= 7 ms

The transmission rate of the packet from Host A to Host B is 4 Mbps. The time taken to transfer the packets can be calculated as:

time taken 2= (56 x 8) bits / 4 x 10⁶ bits/s

                    = 1.12 x 10⁻⁴ s

time taken 2= 112 μs

The propagation delay is 18 ms.

To calculate the total time elapsed, we need to add up all the time taken at each individual stage.

<u />Time_{total}<u> = Time taken 1 + Time taken 2 + Propagation Delay</u>

                 = 7 ms + 112 μs + 18 ms

                 = 0.025112 s

Time_{total} = 25.11 ms

5 0
2 years ago
Other questions:
  • What is a cursor?
    6·2 answers
  • A _______ is a shortcut to a web page saved in a list in the internet explorer desktop application.
    14·1 answer
  • As an information user you should be skeptical of
    7·1 answer
  • Prove that f(n) = 20n3 + 10nlogn + 5 is O(n3)
    12·1 answer
  • 10) What is the BEST way to rewrite sentence (1) to make it more
    5·2 answers
  • A _________________________ can use SOAP headers to carry meta information in its messages. A. Web service B. REST Service C. Co
    14·1 answer
  • Remember that it is desirable for good block ciphers that a change in one input bit affects many output bits, a property that is
    9·1 answer
  • What text results in variable white space (blank) texts results In even white space
    9·1 answer
  • Consider the following 3-PARTITION problem. Given integers a1; : : : ; an, we want to determine whether it is possible to partit
    10·1 answer
  • The height of a small rocket y can be calculated as a function of time after blastoff with the following piecewise function: y 5
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!