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
o-na [289]
3 years ago
5

/*Implement a class Address . An address has a house number, a street, an optional

Computers and Technology
1 answer:
Ludmilka [50]3 years ago
8 0

Answer:

Java.

Explanation:

public class Address {

   int houseNumber;

   String street;

   int apartmentNumber;

   String city;

   String state;

   int postalCode;

   public Address(int houseNumber, String street, String city, String state, int postalCode) {

       this.houseNumber = houseNumber;

       this.street = street;

       this.city = city;

       this.state = state;

       this.postalCode = postalCode;

   }

   public Address(int houseNumber, String street, int apartmentNumber, String city, String state, int postalCode) {

       this(houseNumber, street, city, state, postalCode);

       this.apartmentNumber = apartmentNumber;

   }

   public void printAddress() {

       System.out.printf("Street: %s%n", this.street);

       System.out.printf("City: %s, State: %s, Postal Code: %d.%n", this.city, this.state, this.postalCode);

   }

   public boolean comesBefore(Address other) {

       if (this.postalCode < other.postalCode) {

           return true;

       }

       else {

           return false;

       }    

   }

}

The few changes I made are in bold.

You might be interested in
Write a C++ function with the following signature: void readAndConvert() The function takes no parameters and returns no value.
shepuryov [24]

Answer:

The function is as follows:

void readAndConvert(){

   int n; string symbol,name;

   cin>>n;

   cin>>symbol;

   cin.ignore();

   getline (cin,name);

   vector<string> trades;

   string trade;

   for (int inps = 0; inps < n; inps++){

       getline (cin,trade);

       trades.push_back(trade);}

   

   cout<<name<<" ("<<symbol<<")"<<endl;

   for (int itr = 0; itr < n; itr++){

       string splittrade[3];        int k = 0;

       for(int j=0;j<trades.at(itr).length();j++){

           splittrade[k] += trades.at(itr)[j];

           if(trades.at(itr)[j] == ' '){

               k++;    }}

cout<<splittrade[2]<<": "<<floor(stod(splittrade[1]) * stod(splittrade[0]))<<endl;        }

   }

Explanation:

See attachment for complete program where comments are used to explain each line

Download cpp
4 0
3 years ago
What is the type of data in the list [103, 405, 527, 396, 503]?
Mariulka [41]

Answer:

alphanumeric.........

3 0
3 years ago
Read 2 more answers
What data type stores images and audio visual clips???
nevsk [136]
Jpg is what I use for my audio and images
3 0
3 years ago
A1 = 10, A2 = 23. Write the formula you would use in Excel to add these two cells together. Is the formula 10 + 23? I don't know
Reptile [31]
=a1=a2 Hope this helps

6 0
3 years ago
Which of the following is true? You are a project manager for Laredo Pioneer's Traveling Rodeo Show. You're heading up a project
nika2105 [10]

Answer: C. You are a project manager for Laredo Pioneer's Traveling Rodeo Show. You're heading up a project to promote a new line of souvenirs to be sold at the shows. You're ready to document the processes you'll use to perform the project as well as define how the project will be executed and controlled and how changes will be monitored and controlled. You are working on the project management plan.

Explanation:

4 0
3 years ago
Other questions:
  • What component on a smartphone requires pairing with another device?
    8·1 answer
  • Explain why blocking ping (ICMP echo request) packets at an organization's edge router is not an effective defense against ping
    11·1 answer
  • Write a statement to create a Google Guava Multimap instance which contains student ids as keys and the associated values are st
    12·1 answer
  • In the RGB model, which color is formed by combining the constituent colors?
    14·2 answers
  • This is a text message that is stored on a user's computer by a Web server that helps trace the user's browsing habits. a. Scrip
    14·1 answer
  • ____________ facilitates the processes that help an organization function by applying information and communication technologies
    5·1 answer
  • Making the data impossible to recover even by applying physical forensics methods is known as __________ of media.
    13·1 answer
  • Which of the following is a precaution that helps to protect you from electric shock when working with electric power tools?
    7·2 answers
  • Write a program to enter length of a square and print area of square.<br>(class 8)​
    9·2 answers
  • Can be referred to as a universal network of interrelated computers which delivers a very wide variety of information and commun
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!