Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
DASC	1204	–	Programming	Project	2	
Due	Date	–	02/16/2022	at	11:59pm		
1.	Problem	Statement:		The	goal	of	this	programming	assignment	is	to	give	students	experience	with	iterative	statements	and	error	checking	code	in	Java.	In	particular,	your	task	is	to	implement	a	simulation	of	how	much	money	you	can	make	by	digging	up	and	selling	vintage	Atari	game	cartridges	from	a	New	Mexico	landfill.			First,	some	ancient	history.	The	video	game	market	in	the	early	1980s	was	growing	exponentially,	driven	by	the	sales	of	Atari	2600	games	like	“Asteroids”,	“Space	Invaders”	and	“Pac	Man”.	To	cash	in	on	this	craze,	Atari	started	producing	new	video	games	as	quickly	as	they	could.	Unfortunately,	they	created	some	horrible	games,	including	“E.T.	the	Extra-Terrestrial”,	often	cited	as	one	of	the	worst	video	games	of	all	time.	The	market	for	video	games	crashed	in	1983,	and	Atari	was	left	with	millions	of	unsold	game	cartridges.	For	some	reason,	they	decided	to	bury	them	in	a	New	Mexico	landfill,	where	they	remained	until	discovered	and	partially	excavated	in	2013	(see	Wikipedia	for	details).		
	 		The	recent	interest	in	vintage	Atari	games	has	now	made	these	old	video	game	cartridges	valuable	to	collectors.	Your	task	is	to	write	a	program	that	simulates	how	much	money	you	could	make	by	digging	up	and	selling	vintage	Atari	game	cartridges	from	this	New	Mexico	landfill.	Your	program	should	simulate	52	weeks	of	excavations	and	calculate	the	following:			
• The	number	of	man	hours	spent	digging	in	a	week.	At	the	start	of	your	program,	you	should	prompt	the	user	for	how	many	people	you	want	to	hire	to	dig	in	the	landfill.	The	user	must	choose	a	number	between	1	and	5.	You	can	assume	that	workers	dig	for	20	hours	per	week	on	a	hot	week,	and	30	hours	per	week	on	a	cool	week.	You	should	use	a	random	number	generator	to	“flip	a	coin”	to	see	if	it	is	hot	or	cold	and	use	this	information	to	calculate	and	print	the	number	of	man	hours	your	workers	spend	digging	each	week.		
• The	number	of	game	cartridges	found	in	a	week.	The	video	game	cartridges	are	mixed	in	with	all	sorts	of	garbage	in	the	landfill,	so	it	takes	hard	work	and	luck	to	find	them.	To	simulate	this,	your	program	should	use	a	random	number	generator	to	“roll	the	dice”	to	get	a	number	between	1	and	6	to	determine	how	many	video	games	are	found	for	each	man	hour	of	digging.	Use	this	information	to	calculate	and	print	the	total	number	of	game	cartridges	you	find	in	the	week.		
• The	sales	price	of	the	game	cartridges	found	in	a	week.	There	is	only	so	much	demand	for	vintage	game	cartridges,	so	the	sales	price	is	inversely	proportional	to	the	number	of	game	cartridges	being	sold.	If	you	are	selling	between	1	and	99	game	cartridges,	the	sales	price	is	$10	per	cartridge.	If	you	are	selling	between	100	and	199	game	cartridges,	the	sales	price	is	($20	–	count/10).	If	you	are	selling	200	or	more	game	cartridges,	the	sales	price	is	$1	per	game.	Your	program	should	calculate	and	print	this	value	based	on	the	number	of	game	cartridges	found	this	week.		
• The	profit/loss	for	that	week.	You	should	calculate	and	print	the	profit/loss	for	each	week	using	the	number	of	man	hours	spent	digging,	the	number	of	game	cartridges	found,	and	the	sales	price.	At	the	start	of	your	program,	you	should	prompt	the	user	to	enter	the	hourly	wage	of	your	workers.	The	wage	value	must	be	between	$11.50/hour	(the	minimum	wage	in	New	Mexico)	and	$50/hour	(the	average	salary	for	a	data	scientist	in	NWA).		
• The	total	profit/loss	for	the	year.	After	your	program	has	printed	the	four	values	above	for	each	week	in	your	52	week	simulation,	you	should	calculate	and	print	the	total	profit/loss	for	the	year.	If	you	are	lucky	you	may	make	some	nice	money,	and	maybe	buy	yourself	a	new	gaming	system.	If	you	are	unlucky,	you	may	lose	your	shirt	like	Atari,	and	have	to	sell	some	of	your	current	video	games	to	pay	for	next	semester’s	tuition.		
2.	Design:	
	Your	first	design	task	is	to	decide	what	messages	to	print,	and	what	loops	and	conditionals	are	needed	to	get	the	number	of	workers,	and	hourly	wage	from	the	user.	Your	program	should	do	error	checking	loops	to	make	sure	the	user	enters	values	in	the	desired	range.	Your	second	design	task	is	to	decide	what	loops	and	conditionals	are	needed	to	implement	the	52	week	simulation.	You	will	also	need	to	work	out	the	formulas	needed	to	calculate	the	four	values	described	above.	Your	final	design	task	is	to	work	out	how	to	display	the	results	of	your	52	week	simulation	in	a	table	that	can	be	easily	read.			
Hint:	In	order	to	“flip	a	coin”	or	“roll	the	dice”	in	a	program,	you	need	to	call	a	random	number	generator	function.	To	do	this	in	Java,	we	can	call	the	“Math.random()”	function.	Every	time	you	call	this	function	it	returns	a	double	in	the	range	[0.0	..	1.0)	that	looks	very	random	but	is	actually	generated	using	a	clever	formula.	We	can	create	random	integer	values	in	a	different	range	as	follows:		
int	coin	=	Math.random()	*	2;		 	 //	random	value	will	be	in	[0	..	1]	int	dice	=	Math.random()	*	6	+	1;	 	 //	random	value	will	be	in	[1	..	6]		You	will	notice	that	Math.random()	generates	different	random	numbers	every	time	your	program	is	run.	This	is	because	they	use	a	random	number	generator	“seed”	based	on	the	time	of	day,	so	you	should	never	get	the	same	sequence	twice.			
3.	Implementation:		Since	you	are	starting	with	a	"blank	piece	of	paper"	to	implement	this	project,	it	is	very	important	to	develop	your	code	incrementally	writing	comments,	adding	code,	compiling,	debugging,	a	little	bit	at	a	time.	This	way,	you	always	have	a	program	that	"does	something"	even	if	it	is	not	complete.		As	a	first	step,	it	is	always	a	good	idea	to	start	with	an	empty	main	function	and	add	the	code	to	read	input	data	from	the	user,	and	then	simply	print	these	values	back	out	again.	Once	this	part	is	working,	you	can	start	performing	calculations	with	the	input	data.		
4.	Testing:		Test	your	program	to	check	that	it	operates	correctly	for	all	requirements	listed	above.	To	verify	that	you	are	calculating	the	output	values	correctly,	you	should	try	a	variety	of	input	values	and	check	your	answers	by	hand.	You	should	SAVE	your	program	output	to	include	in	your	project	report.		You	are	not	required	to	add	error	checking	for	invalid	inputs	in	this	program,	but	it	is	always	good	to	test	a	program	to	see	what	happens	to	your	program	if	the	user	inputs	unexpected	data	(like	a	negative	number	or	“hello	mom”).	You	should	cut/paste	these	results	into	your	project	report	to	document	what	your	program	does	in	these	cases.		
5.	Documentation:		When	you	have	completed	your	Java	program,	write	a	short	report	using	the	“Programming	Project	Report	Template”	describing	what	the	objectives	were,	what	you	did,	and	the	status	of	the	program.	Does	it	work	properly	for	all	test	cases?	Are	there	any	known	problems?	Save	this	project	report	in	a	separate	document	to	be	submitted	electronically.		
6.	Project	Submission:		When	you	have	your	midpoint	code	ready	to	submit,	go	to	the	Blackboard	project	description	page	and	submit	your	program	(as	a	.java	file).	You	do	not	need	to	upload	project	documentation	for	the	midpoint.	When	you	have	completed	the	programming	project,	upload	your	final	program	(as	a	.java	file)	and	your	project	documentation	(as	a	.docx	or	.pdf	file).			
The	dates	on	your	electronic	submission	will	be	used	to	verify	that	you	met	the	due	date	above.	All	late	projects	will	receive	reduced	credit:		10%	off	if	less	than	1	day	late,	20%	off	if	less	than	2	days	late,	30%	off	if	less	than	3	days	late,	no	credit	if	more	than	3	days	late.			You	will	receive	partial	credit	for	all	programs	that	compile	even	if	they	do	not	meet	all	program	requirements,	so	handing	projects	in	on	time	is	highly	recommended.		
7.	Academic	Honesty	Statement:		Students	are	expected	to	submit	their	own	work	on	all	programming	projects,	unless	group	projects	have	been	explicitly	assigned.	Students	are	NOT	allowed	to	distribute	code	to	each	other	or	copy	code	from	another	individual	or	website.	Students	ARE	allowed	to	use	any	materials	on	the	class	website,	or	in	the	textbook,	or	ask	the	instructor	and/or	GTAs	for	assistance.		This	course	will	be	using	highly	effective	program	comparison	software	to	calculate	the	similarity	of	all	programs	to	each	other,	and	to	homework	assignments	from	previous	semesters.	Please	do	not	be	tempted	to	plagiarize	from	another	student.		Violations	of	the	policies	above	will	be	reported	to	the	provost’s	office	and	may	result	in	a	ZERO	on	the	programming	project,	an	F	in	the	class,	or	suspension	from	the	university,	depending	on	the	severity	of	the	violation	and	any	history	of	prior	violations.