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
ipn [44]
3 years ago
14

Write the function mystrchr(). the function has two parameters: a const char * s pointing to the first character in a c-style st

ring, and a char
c. return a pointer to the first appearance of c appearing inside s and nullptr (0) if c does not appear inside s.
Computers and Technology
1 answer:
GrogVix [38]3 years ago
7 0
<span>c. return a pointer to the first appearance of c appearing inside s and nullptr (0) if c does not appear inside s.</span>
You might be interested in
Write a method so that the main() code below can be replaced by the simpler code that calls method mphAndMinutesToMiles(). Origi
defon

ANSWER

The JAVA program after simplification is as below.

import java.util.Scanner;

public class CalcMiles {

   

   // variables declaration

   static double milesPerHour;

   static double minutesTraveled;      

   static double hoursTraveled;

   static double milesTraveled;

   

   // method declared static

   public static void mphAndMinutesToMiles(double speed, double mins)

   {

       // computations to calculate distance travelled

       hoursTraveled = mins / 60.0;

       milesTraveled = hoursTraveled * speed;

       

       // result displayed on the screen  

     System.out.println("Miles: " + milesTraveled);

   }

   

   // Scanner object created inside main()

   // user input taken inside main()

   public static void main(String [] args)

   {

       Scanner scnr = new Scanner(System.in);

       System.out.println("Enter miles travelled per hour ");

       milesPerHour = scnr.nextDouble();

       System.out.println("Enter minutes required to travel ");

       minutesTraveled = scnr.nextDouble();

       

       mphAndMinutesToMiles(milesPerHour, minutesTraveled);

       

   }

}

OUTPUT

Enter miles travelled per hour  

2.3

Enter minutes required to travel  

1234

Miles: 47.30333333333333

EXPLANATION

The program is simplified as explained below.

1. User input is taken using the object of Scanner class.

2. This object of Scanner class can only be created inside main() method hence, user input can only be taken inside main().

3. The code to calculate the result is separated in another method, mphAndMinutesToMiles(). This method is declared with return type void since no value is returned.

4. After user input is taken in main() for miles travelled per hour and minutes required to travel, these values are passed as parameters to the mphAndMinutesToMiles() method.

5. These parameters are used in calculation part. The total miles travelled in total hours (obtained from minutes), is calculated. The code to display the result is added to this method.

6. Inside the main method, only the code to create Scanner object, code to take user input for two variables and code to call the mphAndMinutesToMiles() is included.

7. The variables are declared as static and declared at class level.

8. No variable is declared inside any of the two methods.

5 0
3 years ago
Read 2 more answers
What key should you press and hold to select and open multiple files at one time? Enter Alt Control Esc
Yuliya22 [10]

Press and hold down the CTRL key while you drag the file to another folder. Press and hold down CTRL+SHIFT while you drag a file to the desktop or a folder.

3 0
3 years ago
Read 2 more answers
When saving a memo you created in Word, which of the following extensions is automatically assigned to the document?
Lena [83]
.docx is the default file extension on a Word doc.
6 0
3 years ago
Read 2 more answers
Explain the concept of an engineering trade-offs and give an example
makvit [3.9K]

ytfjkhm,MNbkvjhmb,kn.l">

k

8 0
3 years ago
Read 2 more answers
What are some things that games were historically used for?
madreJ [45]

Answer:

D) All of the above

Explanation:

All of these options are true.

Hope it helps and is correct!

5 0
3 years ago
Other questions:
  • A computer’s BIOS is defined as the
    12·2 answers
  • Create a structure named planet This structure will contain distance from Earth as an integer Atmosphere, language, people and p
    8·1 answer
  • Linux would be a good example of?
    6·1 answer
  • Develop a Matlab program that allows you to plot the entropy of a source with variable output probabilities. We wish to observe
    8·1 answer
  • Write a program that uses these bounds and bisection search (for more info check out the Wikipedia page on bisection search) to
    8·1 answer
  • Above all, you want to implement the cheapest CRM system available. You are willing to accept any risks associated with this, so
    11·1 answer
  • A popular database software program called ____ offers a wizard and QBE tool to help build and generate SQL queries
    9·1 answer
  • Your job is to choose a data structure to implement polynomials whose coefficients are positive integers, such as 17x^4+4x^3+0x^
    9·1 answer
  • 7.4 Lesson Practice (projectstem): what is output if the user is enters 2?​
    8·1 answer
  • We love silky. she is very honest join this by using conjunction ​
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!