SlideShare a Scribd company logo
Python Program
Do not use import please. Problem 1: Rolodex (Note: A Rolodex is a Contact List) Write a
program that manages a rolodex. This program prompts the user for the name of a rol file. This
program should be able to load any rol file and require that the file extension -i.e the last 4 letters
of the file be rol. The file rol is consider a valid file. If the file exists the program loads in the
contacts stored in the file. A Rolodex contains unique individuals, no duplicate names are
allowed. However, name lookups are case sensitive, so "Apple" and "apple" are considered
different names allowed However, name
Solution
Rolodex.java
public class Rolodex{
String name;
String phone;
String email;
String note;
Rolodex(String name,String phone,String email,String note){
this.name=name;
this.phone=phone;
this.email=email;
this.note=note;
}
public String tostring(){
return "name:"+name+" phone:"+phone +" email:"+email+ " note:"+note;
}
}
rolodexmain.java
import java.util.*;
public class rolodexmain {
static Scanner sc=new Scanner(System.in);
static Listlist=new ArrayList();
static Setsets=new HashSet();
public static void main(String[] args) {
// TODO Auto-generated method stub
while(true){
System.out.println("Rolodex comands t Insert(i),remove(R),
Lookbyname(F),LookbyPhone number(N),Lookby email(E)saves(S),save and
quit(Q),printall(P),quit and dont save(X)");
char ch=sc.next().charAt(0);
switch(ch){
case 'I':
insert(list);
break;
case 'R':
deleted(list);
break;
case 'F':
Lookbyname(list);
break;
case 'N':
Lookbyphonenumber(list);
break;
case 'E':
Lookbyemail(list);
break;
case 'P':
printall(list);
break;
case 'X':
System.exit(0);
case 'S':
saves(list);
break;
case 'Q':
savesandquit(list);
System.exit(0);
}
}
}
public static void insert(List list){
System.out.println("please enter contact name:");
String name=sc.next();
System.out.println("please enter contact phone number:");
String phone=sc.next();
System.out.println("please enter contact email id:");
String email=sc.next();
System.out.println("please enter contact note:");
String note=sc.next();
Rolodex r=new Rolodex(name,phone,email,note);
list.add(r);
}
public static void deleted(List list){
boolean flag=false;
System.out.println("enter name of contact to delete :");
String dname=sc.next();
for(int i=0;i list){
System.out.println("enter name of contact which you want to look :");
String lname=sc.next();
for(int i=0;i list){
System.out.println("please enter phone number which you want to look:");
String lphone=sc.next();
for(int i=0;i list){
System.out.println("please enter phone number which you want to look:");
String lemail=sc.next();
for(int i=0;i list){
for(int i=0;i list){
sets.addAll(list);
for (Rolodex o : sets) {
// Rolodex r=(Rolodex)sets;
System.out.println(o.tostring());
}
}
public static void savesandquit(List list){
sets.addAll(list);
for (Rolodex o : sets) {
// Rolodex r=(Rolodex)sets;
System.out.println(o.tostring());
}
}
}
output:
Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby
email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X)
I
please enter contact name:
SWARUP
please enter contact phone number:
567889
please enter contact email id:
SWARUP@
please enter contact note:
CONTACT
Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby
email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X)
I
please enter contact name:
ALISA
please enter contact phone number:
123
please enter contact email id:
ALISE@
please enter contact note:
NEW
Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby
email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X)
F
enter name of contact which you want to look :
SWARUP
name:SWARUP
phone:567889
email:SWARUP@
note:CONTACT
Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby
email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X)
N
please enter phone number which you want to look:
567889
name:SWARUP
phone:567889
email:SWARUP@
note:CONTACT
Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby
email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X)
E
please enter phone number which you want to look:
ALISE@
name:ALISA
phone:123
email:ALISE@
note:NEW
Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby
email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X)
P
name:SWARUP
phone:567889
email:SWARUP@
note:CONTACT
name:ALISA
phone:123
email:ALISE@
note:NEW
Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby
email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X)
S
name:ALISA
phone:123
email:ALISE@
note:NEW
name:SWARUP
phone:567889
email:SWARUP@
note:CONTACT
Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby
email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X)
X

More Related Content

PDF
[10] Write a Java application which first reads data from the phoneb.pdf
PPT
Linq And Its Impact On The.Net Framework
PDF
Java Week4(C) Notepad
PPTX
PDF
Python Part 1
PDF
11-ch04-3-strings.pdf
PDF
Perl_Part6
PPTX
C# overview part 1
[10] Write a Java application which first reads data from the phoneb.pdf
Linq And Its Impact On The.Net Framework
Java Week4(C) Notepad
Python Part 1
11-ch04-3-strings.pdf
Perl_Part6
C# overview part 1

Similar to Python ProgramDo not use import please. Problem 1 Rolodex (Note .pdf (20)

PDF
For this homework, you will write a program to create and manipulate.pdf
PPT
Lecture 4 - Comm Lab: Web @ ITP
DOCX
03.DS_Store__MACOSX03._.DS_Store03A2.DS_Store__.docx
PDF
Word games in c
PDF
Suppose that you and I are friends on Facebook. and you want to figur.pdf
PPTX
Introduction on basic python and it's application
PPT
PDF
beginners_python_cheat_sheet_pcc_all.pdf
PDF
Beginner's Python Cheat Sheet.pdf
PDF
beginners_python_cheat_sheet_pcc_all.pdf
PPTX
Best of build 2021 - C# 10 & .NET 6
PDF
Not sure why my program wont run.Programmer S.Villegas helper N.pdf
PDF
Real World Haskell: Lecture 7
PDF
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
PDF
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
PDF
Create a C program which auto-completes suggestions when beginning t.pdf
PPT
PostThis
PPT
Clean code _v2003
PDF
Getting the following errorsError 1 error C2436 {ctor} mem.pdf
PDF
I have the following code and I need to know why I am receiving the .pdf
For this homework, you will write a program to create and manipulate.pdf
Lecture 4 - Comm Lab: Web @ ITP
03.DS_Store__MACOSX03._.DS_Store03A2.DS_Store__.docx
Word games in c
Suppose that you and I are friends on Facebook. and you want to figur.pdf
Introduction on basic python and it's application
beginners_python_cheat_sheet_pcc_all.pdf
Beginner's Python Cheat Sheet.pdf
beginners_python_cheat_sheet_pcc_all.pdf
Best of build 2021 - C# 10 & .NET 6
Not sure why my program wont run.Programmer S.Villegas helper N.pdf
Real World Haskell: Lecture 7
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Create a C program which auto-completes suggestions when beginning t.pdf
PostThis
Clean code _v2003
Getting the following errorsError 1 error C2436 {ctor} mem.pdf
I have the following code and I need to know why I am receiving the .pdf
Ad

More from fortmdu (20)

PDF
How is a Decision Support Systems (DSS) different from a Management .pdf
PDF
I am trying to create a program That works with two other programs i.pdf
PDF
How does anti-malware software detect virusesWhat techniques are .pdf
PDF
How can I upload a picture in here I tried with image properties ic.pdf
PDF
Explain the role of ATP in the action of Hsp70 and GroELES.Solu.pdf
PDF
Files Please respond to the following •Suppose you are creating.pdf
PDF
evil_server.cpp#include string #include cstdlib #include.pdf
PDF
ecorrect Question 32 0 1 pts Referencing the diagram above, use the .pdf
PDF
Disneys Expedition EverestOne of the newest thrill rides to open.pdf
PDF
Discuss ONE risk that a company faces when trying to diversify inte.pdf
PDF
Describe at least one reason why transitioning from PVST+ to Rapid P.pdf
PDF
CASE 2-1 BUILDING UP OUR ASSETS DHR CONSTRUCTIONIn August 2011, w.pdf
PDF
C++ Write a function that takes two numbers are parameters and retu.pdf
PDF
B.1 Reaction of a Hydrate Addition of Water (2) Appearance Heating (1.pdf
PDF
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
PDF
You maintain several virtual machines (VMs) in an offline state. How.pdf
PDF
Which of the following statements is not TRUE1)For a 64-bit compute.pdf
PDF
You are running an ELISA on a sample to test for the presence of .pdf
PDF
You are to write an efficient program that will read a dictionary of.pdf
PDF
X = C B - B C D; Use Accumulator Register-Register (LoadSt.pdf
How is a Decision Support Systems (DSS) different from a Management .pdf
I am trying to create a program That works with two other programs i.pdf
How does anti-malware software detect virusesWhat techniques are .pdf
How can I upload a picture in here I tried with image properties ic.pdf
Explain the role of ATP in the action of Hsp70 and GroELES.Solu.pdf
Files Please respond to the following •Suppose you are creating.pdf
evil_server.cpp#include string #include cstdlib #include.pdf
ecorrect Question 32 0 1 pts Referencing the diagram above, use the .pdf
Disneys Expedition EverestOne of the newest thrill rides to open.pdf
Discuss ONE risk that a company faces when trying to diversify inte.pdf
Describe at least one reason why transitioning from PVST+ to Rapid P.pdf
CASE 2-1 BUILDING UP OUR ASSETS DHR CONSTRUCTIONIn August 2011, w.pdf
C++ Write a function that takes two numbers are parameters and retu.pdf
B.1 Reaction of a Hydrate Addition of Water (2) Appearance Heating (1.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
You maintain several virtual machines (VMs) in an offline state. How.pdf
Which of the following statements is not TRUE1)For a 64-bit compute.pdf
You are running an ELISA on a sample to test for the presence of .pdf
You are to write an efficient program that will read a dictionary of.pdf
X = C B - B C D; Use Accumulator Register-Register (LoadSt.pdf
Ad

Recently uploaded (20)

PPTX
GDM (1) (1).pptx small presentation for students
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Presentation on HIE in infants and its manifestations
PDF
01-Introduction-to-Information-Management.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
Lesson notes of climatology university.
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Final Presentation General Medicine 03-08-2024.pptx
GDM (1) (1).pptx small presentation for students
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Cell Structure & Organelles in detailed.
O7-L3 Supply Chain Operations - ICLT Program
Presentation on HIE in infants and its manifestations
01-Introduction-to-Information-Management.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
A systematic review of self-coping strategies used by university students to ...
VCE English Exam - Section C Student Revision Booklet
Chinmaya Tiranga quiz Grand Finale.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
O5-L3 Freight Transport Ops (International) V1.pdf
Cell Types and Its function , kingdom of life
Lesson notes of climatology university.
Supply Chain Operations Speaking Notes -ICLT Program
Final Presentation General Medicine 03-08-2024.pptx

Python ProgramDo not use import please. Problem 1 Rolodex (Note .pdf

  • 1. Python Program Do not use import please. Problem 1: Rolodex (Note: A Rolodex is a Contact List) Write a program that manages a rolodex. This program prompts the user for the name of a rol file. This program should be able to load any rol file and require that the file extension -i.e the last 4 letters of the file be rol. The file rol is consider a valid file. If the file exists the program loads in the contacts stored in the file. A Rolodex contains unique individuals, no duplicate names are allowed. However, name lookups are case sensitive, so "Apple" and "apple" are considered different names allowed However, name Solution Rolodex.java public class Rolodex{ String name; String phone; String email; String note; Rolodex(String name,String phone,String email,String note){ this.name=name; this.phone=phone; this.email=email; this.note=note; } public String tostring(){ return "name:"+name+" phone:"+phone +" email:"+email+ " note:"+note; } } rolodexmain.java import java.util.*; public class rolodexmain { static Scanner sc=new Scanner(System.in); static Listlist=new ArrayList();
  • 2. static Setsets=new HashSet(); public static void main(String[] args) { // TODO Auto-generated method stub while(true){ System.out.println("Rolodex comands t Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X)"); char ch=sc.next().charAt(0); switch(ch){ case 'I': insert(list); break; case 'R': deleted(list); break; case 'F': Lookbyname(list); break; case 'N': Lookbyphonenumber(list); break; case 'E': Lookbyemail(list); break; case 'P': printall(list); break; case 'X':
  • 3. System.exit(0); case 'S': saves(list); break; case 'Q': savesandquit(list); System.exit(0); } } } public static void insert(List list){ System.out.println("please enter contact name:"); String name=sc.next(); System.out.println("please enter contact phone number:"); String phone=sc.next(); System.out.println("please enter contact email id:"); String email=sc.next(); System.out.println("please enter contact note:"); String note=sc.next(); Rolodex r=new Rolodex(name,phone,email,note); list.add(r); } public static void deleted(List list){ boolean flag=false; System.out.println("enter name of contact to delete :"); String dname=sc.next(); for(int i=0;i list){
  • 4. System.out.println("enter name of contact which you want to look :"); String lname=sc.next(); for(int i=0;i list){ System.out.println("please enter phone number which you want to look:"); String lphone=sc.next(); for(int i=0;i list){ System.out.println("please enter phone number which you want to look:"); String lemail=sc.next(); for(int i=0;i list){ for(int i=0;i list){ sets.addAll(list); for (Rolodex o : sets) { // Rolodex r=(Rolodex)sets; System.out.println(o.tostring()); } } public static void savesandquit(List list){ sets.addAll(list); for (Rolodex o : sets) { // Rolodex r=(Rolodex)sets; System.out.println(o.tostring()); } } } output: Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X) I please enter contact name:
  • 5. SWARUP please enter contact phone number: 567889 please enter contact email id: SWARUP@ please enter contact note: CONTACT Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X) I please enter contact name: ALISA please enter contact phone number: 123 please enter contact email id: ALISE@ please enter contact note: NEW Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X) F enter name of contact which you want to look : SWARUP name:SWARUP phone:567889 email:SWARUP@ note:CONTACT Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X) N please enter phone number which you want to look: 567889 name:SWARUP phone:567889 email:SWARUP@ note:CONTACT
  • 6. Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X) E please enter phone number which you want to look: ALISE@ name:ALISA phone:123 email:ALISE@ note:NEW Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X) P name:SWARUP phone:567889 email:SWARUP@ note:CONTACT name:ALISA phone:123 email:ALISE@ note:NEW Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X) S name:ALISA phone:123 email:ALISE@ note:NEW name:SWARUP phone:567889 email:SWARUP@ note:CONTACT Rolodex comands Insert(i),remove(R), Lookbyname(F),LookbyPhone number(N),Lookby email(E)saves(S),save and quit(Q),printall(P),quit and dont save(X) X