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
Style of music that originated in New Orleans in the early 1900s
Sever21 [200]

Answer:

jazz

Explanation:

7 0
3 years ago
Read 2 more answers
In the given switch statement, what will be displayed if the value of var is 3? switch(var) { case 1: System.out.println("Apple"
olga_2 [115]

Answer:

The output of the given program is  

Peach Pear Pineapple.

Explanation:

since the value of var is so control will move to the case 3 directly and executed the statement inside the case 3 so it will print "Peach" in window after that their is no break statement in the case 3 the control moves the case 4 and executed the statement inside the case 4 so it will print "Pear" in window again there is no break statement in the case 4 the control moves the case 5 and executed the statement inside the case 5 so it will print "Pineapple".Finally, the break statement is reached the execution of the program is stopped.

3 0
3 years ago
How to be professional in graphic design without CAD?
Mama L [17]

Answer:

There are two types of image processing software, raster-based, and vector-based. The CAD and the CAID are just the two vectors based software. However, there is much other software like Adobe Illustrator, Microsoft Publisher, Corel Draw, Photoshop on which you can embark upon, and become an equally good Graphics designer. And hence, you can certainly become a Graphics designer with the CAD experience, however, you should keep in mind that all the great Graphic designers use CAD and CAID. And hence, you should use it sometimes certainly in the future.

Explanation:

Please check the answer section.

4 0
3 years ago
Define an iterative function named append_ordered; it is passed two arguments: a linked list (ll) whose values are ordered from
enot [183]

Answer:

A python programming language (code) was used for this exercise.

The code is shown below in the explanation section

Explanation:

Solution

Python code:

class LN:

def __init__(self,value,next=None):

self.value = value

self.next = next

  def list_to_ll(self,l):

if l == []:

return None

front = rear = LN(l[0])

for v in l[1:]:

rear.next = LN(v)

rear = rear.next

return front

  def str_ll(self,ll):

answer = ''

while ll != None:

answer += str(ll.value)+'->'

ll = ll.next

return answer + 'None'

def append_ordered(self,ll,v):

ln1=LN(v); #create a node with the new value by creating an instance of the LN class

if ll is None: #if the linked list is empty

ll=ln1 #return the new created node

elif(ll.value >= ln1.value): #if the value to be add is smallest, append the linked list to it

ln1.next=ll

ll=ln1

else:

current=ll; #crate a temporary pointer to iterate over linked list

#iterate till the next node value is smaller than the new value and list is not over

while (current.next is not None and current.next.value < ln1.value):

current=current.next

ln1.next=current.next #save the current node in the next of the new node

current.next=ln1 #save new node in the next of current node

return ll

ln=LN(0); #create an instance of class LN

ll1=ln.list_to_ll([1,2,4,5]); #create a linked list of the list

answer=ln.str_ll(ll1);    

print(answer); #print the linked list

ll2=ln.append_ordered(ll1,3); #append the value 3 in the linked list

answer=ln.str_ll(ll2)

print(answer); #print the new linked list

Now,

  • If Linked list is empty then make the node as head and return it.
  • If value of the node to be inserted is smaller than value of head node, then insert the node at start and make it head.
  • In a loop, find the appropriate node after which the input node ( 10 ) is to be inserted.To find the appropriate node start from head,keep moving until you reach a node GN (12 ) who's value is greater than the input node. The node just before GN is the appropriate node (8).
  • Insert the node (10) after the appropriate node (8) found in step 3.

Note: Kindly find the output python code attached to the question below.

3 0
3 years ago
Certain country in the Caribbean Sea recently held an election to choose its president. Every vote cast was electronic, but unfo
lesya [120]

Answer:

Certain country in the Caribbean Sea recently held an election to choose its president. Every vote cast was electronic, but unfortunately, a recent power surge caused a malfunction in the system just before votes were counted. The only information saved consists of the following facts:

Explanation:

• All the N citizens casted their vote.

• Exactly one candidate received more than N/2 votes.

• We don’t know how many candidates there were.

You are hired to help using your expertise in algorithms.

5 0
2 years ago
Other questions:
  • Tony Stark wants to build a 1000 meter high tower as quickly as possible. He has unlimited resources and an unlimited budget and
    8·2 answers
  • The mutt software is an example of what type of mail service software on Linux? a. Mail Delivery Agent b. Mail Transport Agent c
    5·1 answer
  • P**nhub or x-videos or other
    9·1 answer
  • Keion works as a freelancer creating websites and designing logos for clients. He recently had a hard drive failure and lost wor
    12·1 answer
  • On my iphone there is system services, what are they.
    9·1 answer
  • What’s the best description of an opportunity cost
    5·1 answer
  • PLZZZ HELP!!!
    9·1 answer
  • How do i automate survey monkey results to my email
    11·1 answer
  • 4. Each mobile device described in this chapter requires that the user have a/an ____________________ associated with services o
    5·1 answer
  • A(n) _____ is a computerized system by which subscribers are able to communicate to all other subscribers by sending a transmiss
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!