1answer.
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
Natasha_Volkova [10]
3 years ago
11

After reading the background, please work on the following problem: a. The source process reads information from a file (Therefo

re, you need to prepare a small text file for testing purpose). b. The source process calls fork() to create the filter process. c. The filter process reads information from the source process (passed via an anonymous pipe), converts the uppercase characters to lowercase ones and vice versa, and then prints out the converted characters to the screen.
Computers and Technology
1 answer:
adell [148]3 years ago
4 0

Answer:

Explanation:

The following code is written in Java. It has the main method (source process) and a function called fork() which contains the filter process as described in the question. fork() takes in the file information as a parameter and prints out the information to the screen. The test can be seen with the output in the attached image below.

import java.io.File;

import java.io.FileNotFoundException;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       String data = "";

       try {

           File myObj = new File("C:\\Users\\Gabriel2\\AppData\\Roaming\\JetBrains\\IdeaIC2020.2\\scratches\\input.txt"); //USE YOUR FILE LOCATION

           Scanner myReader = new Scanner(myObj);

           while (myReader.hasNextLine()) {

               data += myReader.nextLine();

               data += "\n";

           }

           myReader.close();

       } catch (FileNotFoundException e) {

           System.out.println("An error occurred.");

           e.printStackTrace();

       }

       System.out.println("Original: \n" + data);

       fork(data);

   }

   public static void fork(String data) {

       String output = "";

       for (int i = 0; i < data.length(); i++) {

           if (Character.isUpperCase(data.charAt(i)) == true) {

               output += Character.toLowerCase(data.charAt(i));

           } else if (Character.isLowerCase(data.charAt(i)) == true) {

               output += Character.toUpperCase(data.charAt(i));

           } else {

               output += data.charAt(i);

           }

       }

       System.out.println("Modified: \n" + output );

   }

}

You might be interested in
Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in
storchak [24]

I wrote my code in python 3.8:

def max_magnitude(num1, num2):

   return num1 if abs(num1) > abs(num2) else num2

print(max_magnitude(-8,-2))

I hope this helps!

4 0
3 years ago
The automated key distribution approach provides the flexibility and dynamic characteristics needed to allow a number of users t
docker41 [41]

Answer:

The correct answer is option A. "True".

Explanation:

Key management could either be manual or automated. The automated key distribution approach is more flexible and dynamic than the manual key distribution approach, because it is better at responding to changing requirements in the system. Additionally, the automated key distribution approach is faster and more economic as well as observable and auditable.

6 0
3 years ago
When designing a suitable and safe flexibility training program, you should set reasonable and appropriate goals depending on wh
GalinKa [24]

Answer:

The following steps will help you design a safe and effective stretching program.

Explanation:

1. You will have to follow the ACSM's guidelines used for flexibility training.

2. evaluate your flexibility rate with the "sit-and-reach" test.

3. you have to also apply the basic principles of FITT in designing your own program.

4. have a "range-of-motion" tests performance.

5. make use of SMART guidelines when setting explicit flexibility goals.

7 0
3 years ago
I need some questions and answers in spreadsheet​
yarga [219]

Answer:

you need to show what you need help with

Explanation:

5 0
3 years ago
Alexi is writing a program which prompts users to enter their race times without decimals. Which function should she use?
Juli2301 [7.4K]

Answer:

It's either B or C

Explanation:

I saw this on another brainly but they said it wasn't print so id say b is most likely

6 0
3 years ago
Read 2 more answers
Other questions:
  • Part 3a. Largest power of two less than (10 pts) Implement the method public static int largestPow2LessThan(int n) which calcula
    5·1 answer
  • When will it be determined whether or not a donor's organs are fit for recovery and transplantation?
    10·2 answers
  • "Technician A says that Ohm's law can be used to determine circuit current flow if total circuit resistance and total voltage ar
    14·1 answer
  • Once a software program has been through one test cycle performed by the programmers and is running proper
    10·1 answer
  • Write a program in which given an integer num, return the sum of the multiples of num between 1 and 100. For example, if num is
    7·1 answer
  • Microsoft’s SharePoint server product dramatically altered the content and records management (RM) markets. Crocker (2015), edit
    6·1 answer
  • PLEASE HELP ASAP!!
    11·2 answers
  • What in the world is this for and how do you use it
    8·2 answers
  • Listed here are a few camera angles and their images.
    10·1 answer
  • What is the BCC feature used for?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!