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
tresset_1 [31]
3 years ago
10

Define the missing function. licenseNum is created as: (100000 * customID) + licenseYear. Sample output:

Computers and Technology
2 answers:
k0ka [10]3 years ago
8 0

#include <iostream>

using namespace std;

class DogLicense {

  public:

     void   SetYear(int yearRegistered);

     void   CreateLicenseNum(int customID);

     int    GetLicenseNum() const;

  private:

     int    licenseYear;

     int    licenseNum;

};

void DogLicense::SetYear(int yearRegistered) {

  licenseYear = yearRegistered;

}

// FIXME: Write CreateLicenseNum()

void DogLicense::CreateLicenseNum(int customID) {

   licenseNum = (100000 * customID) + licenseYear;

}

int DogLicense::GetLicenseNum() const {

  return licenseNum;

}

int main() {

  DogLicense dog1;

  int userYear;

  int userId;

  cin >> userYear;

  cin >> userId;

  dog1.SetYear(userYear);

  dog1.CreateLicenseNum(userId);

  cout << "Dog license: " << dog1.GetLicenseNum() << endl;

  return 0;

}

Juliette [100K]3 years ago
6 0

Answer:

#include <iostream>

using namespace std;

class DogLicense{

   public:

       void SetYear(int yearRegistered);

       void CreateLicenseNum(int customID);

       int GetLicenseNum() const;

   private:

       int licenseYear;

       int licenseNum;

};

void DogLicense::SetYear(int yearRegistered) {

   licenseYear = yearRegistered;

}

void DogLicense::CreateLicenseNum(int customID) {

   licenseNum = (100000 * customID) + licenseYear;

}

int DogLicense::GetLicenseNum() const {

   return licenseNum;

}

int main() {

   DogLicense dog1;

   dog1.SetYear(2014);

   dog1.CreateLicenseNum(777);

   cout << "Dog license: " << dog1.GetLicenseNum() << endl;

return 0;

}

Explanation:

You can see the whole code above, but let me explain the fixed function.

void DogLicense::CreateLicenseNum(int customID) {

   licenseNum = (100000 * customID) + licenseYear;

}

The function header is already declared in the class. It takes <em>customID</em> as a parameter. To find out the <em>lisenseNum</em>, we need to apply the given formula <em><u>(100000 * customID) + licenseYear</u></em>.

You might be interested in
Write an application that inputs a telephone number as a string in the form (555) 555-5555. The application should use String me
Scilla [17]

Answer:

See explaination

Explanation:

// File: TelephoneNumber.java

import java.util.Scanner;

public class TelephoneNumber

{

public static void main(String[] args)

{

Scanner input = new Scanner(System.in);

String inputNumber;

String tokens1[];

String tokens2[];

String areaCode;

String firstThree;

String lastFour;

String allSeven;

String fullNumber;

/* input a telephone number as a string in the form (555) 555-5555BsAt4ube4GblQIAAAAASUVORK5CYII= */

System.out.print("Enter a telephone number as '(XXX) XXX-XXXX': ");

inputNumber = input.nextLine();

System.out.println();

/* use String method split */

tokens1 = inputNumber.split(" ");

/* extract the area code as a token */

areaCode = tokens1[0].substring(1, 4);

/* use String method split */

tokens2 = tokens1[1].split("-");

/* extract the first three digits of the phone number as a token */

firstThree = tokens2[0];

/* extract the last four digits of the phone number as a token */

lastFour = tokens2[1];

/* concatenate the seven digits of the phone number into one string */

allSeven = firstThree + lastFour;

/* concatenate both the area code and the seven digits of the phone number into one full string separated by one space */

fullNumber = areaCode + " " + allSeven;

/* print both the area code and the phone number */

System.out.println("Area code: " + areaCode);

System.out.println("Phone number: " + allSeven);

System.out.println("Full Phone number: " + fullNumber);

}

}

8 0
2 years ago
How does a cell phone change the<br> incoming signals from a caller into sound that<br> you can hear
shtirl [24]

Answer:

they send electrical signals to the buzzer. The buzzer changes those electrical signals into sound. You hear the buzzer sound and know that someone is calling you.

Explanation:

8 0
2 years ago
Read 2 more answers
What part of the code is a signal for the function to execute and pass back a value?
Trava [24]

Answer:

2

Explanation:

6 0
2 years ago
Read 2 more answers
Carbon copy others who are..
My name is Ann [436]

Answer:

Is it Multiple Choice Question?

5 0
2 years ago
Read 2 more answers
PLEASE HURRY!!<br> Look at the image below!
never [62]
The answer would be 2&5 because this is correct
5 0
2 years ago
Read 2 more answers
Other questions:
  • List 3 ways that you can use excel and the features it includes and explain why a spreadsheet is the best choice for this task.
    5·1 answer
  • The main thing that adjusting the aperture controls when taking an image is?
    15·1 answer
  • Which of these is a subdirectory? <br> HTTPS <br> /FAQ <br> .org <br> WWW
    15·1 answer
  • As the operations manager for a supermarket chain, Mai needs to find a telecommunications technology that: enables managers in r
    9·1 answer
  • Which website allows you to host your podcast for at a cost that includes your domain name?
    9·2 answers
  • What is the financial aspect for a business as to what database software they will buy?
    6·1 answer
  • Select the correct answer.
    10·2 answers
  • What do you hope will be in/added GTA 6?
    13·1 answer
  • The 0-1 knapsack problem is the following. A thief robbing a store finds n items. The ith item is worth vi dollars and weighs wi
    14·1 answer
  • What is the basic body structure of html.
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!